Skip to content
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

Fix TestHelper not working when no parameters are given #57

Merged
merged 1 commit into from
Mar 5, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/rocket_pants/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
15 changes: 11 additions & 4 deletions spec/integration/rspec_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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