-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WpApiClient::Collection: Added accessor to get total pages for a cust… #11
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,13 @@ | ||
language: ruby | ||
rvm: | ||
- 2.3.0 | ||
- 2.5.3 | ||
before_install: gem install bundler -v 1.11.2 | ||
script: | ||
- WP_VERSION=4.4 bundle exec rspec | ||
- WP_VERSION=4.5 bundle exec rspec | ||
- WP_VERSION=4.5.3 bundle exec rspec | ||
- WP_VERSION=4.5.3_b13 bundle exec rspec | ||
- WP_VERSION=4.7 bundle exec rspec | ||
- WP_VERSION=4.7.2 bundle exec rspec | ||
cache: bundler |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module WpApiClient | ||
VERSION = "0.3.0" | ||
VERSION = "0.3.1" | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,6 +38,16 @@ | |
expect(@collection.count).to eq 9 | ||
end | ||
|
||
it "should respond to total_pages and total_available" do | ||
expect(@collection).to respond_to(:total_pages) | ||
expect(@collection).to respond_to(:total_available) | ||
end | ||
|
||
it "should have 10 pages and 100 articles" do | ||
expect(@collection.total_pages).to eq(10) | ||
expect(@collection.total_available).to eq(100) | ||
end | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The right hand side is quite magical here. These values are hardcoded in the VCR cassettes: I believe X-WP-TOTAL is 100 and X-WP-TOTALPAGES is 10. My whole testing approach here was flawed, but I think the least worst thing would be to put literals on the right hand side here, like this?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @duncanjbrown making this change. |
||
|
||
it "throws an error when it tries to parse an error response" do | ||
expect { | ||
WpApiClient::Collection.new([{"code"=>"rest_forbidden", "message"=>"You don't have permission to do this.", "data"=>{"status"=>403}}]) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This spec has the same name as the below one and I think it's redundant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@duncanjbrown yeah I will correct this.