summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/v1/liceneses_controller_spec.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/spec/controllers/v1/liceneses_controller_spec.rb b/spec/controllers/v1/liceneses_controller_spec.rb
index 5964556..b2eb705 100644
--- a/spec/controllers/v1/liceneses_controller_spec.rb
+++ b/spec/controllers/v1/liceneses_controller_spec.rb
@@ -5,7 +5,7 @@ describe V1::LicensesController do
let(:licenses) { [] }
it "returns the first page of licenses" do
- License.stub(:most_recent).with(1, 10).and_return(licenses)
+ License.stub(:most_recent).with(page: 1, per_page: 10).and_return(licenses)
xhr :get, :index
@@ -14,7 +14,7 @@ describe V1::LicensesController do
end
it "returns the second page of licenses" do
- License.stub(:most_recent).with(2, 10).and_return(licenses)
+ License.stub(:most_recent).with(page: 2, per_page: 10).and_return(licenses)
xhr :get, :index, page: 2
@@ -23,11 +23,18 @@ describe V1::LicensesController do
end
it "returns the specified number of results" do
- License.stub(:most_recent).with(1, 100).and_return(licenses)
+ License.stub(:most_recent).with(page: 1, per_page: 100).and_return(licenses)
xhr :get, :index, per_page: 100
response.should be_success
assigns(:licenses).should == licenses
end
+
+ it "returns a json response" do
+ License.stub(:most_recent).with(page: 1, per_page: 10).and_return(licenses)
+
+ xhr :get, :index
+ -> { JSON.parse(response.body) }.should_not raise_error
+ end
end
end