Permalink
Browse files

Merge pull request #57 from oakho/fix-testcase-for-rails-4

Fix TestHelper not working when no parameters are given
  • Loading branch information...
Sutto committed Mar 5, 2013
2 parents 08ed9c5 + 1bd0426 commit 82d9e65f416613b9dcd1f977ce01bb6b28721126
Showing with 13 additions and 6 deletions.
  1. +2 −2 lib/rocket_pants/test_helper.rb
  2. +11 −4 spec/integration/rspec_spec.rb
@@ -77,7 +77,7 @@ def have_decoded_response(value)
# Like process, but automatically adds the api version.
def process(action, http_method = 'GET', *args)
# Rails 4 changes the method signature. In rails 3, http_method is actually
- # the paramters.
+ # the parameters.
if http_method.kind_of?(String)
parameters, session, flash = args
else
@@ -89,7 +89,7 @@ def process(action, http_method = 'GET', *args)
if _default_version.present? && parameters[:version].blank? && parameters['version'].blank?
parameters[:version] = _default_version
end
- super
+ super action, parameters, *args
end
def normalise_value(value)
@@ -20,10 +20,17 @@ def self.teardown(*args); end
end
describe 'should have_exposed' do
- it "allows you to asset what should have been exposed by an action" do
- get :echo, :echo => "ping"
-
- response.should have_exposed(:echo => "ping")
+ context "given a request with parameters" do
+ it "allows you to asset what should have been exposed by an action" do
+ get :echo, :echo => "ping"
+ response.should have_exposed(:echo => "ping")
+ end
+ end
+ context "given a request without parameters" do
+ it "allows you to asset what should have been exposed by an action" do
+ get :test_data
+ request.params.should include(:version)
+ end
end
end
end

0 comments on commit 82d9e65

Please sign in to comment.