Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed rails 4.0.0.beta1 compatibility in the TestHelper

  • Loading branch information...
commit eea67c4aa84cec0d9e0afb2a764ddcac1883cf9c 1 parent 378a5b2
@keithpitt keithpitt authored
Showing with 12 additions and 2 deletions.
  1. +9 −1 lib/rocket_pants/test_helper.rb
  2. +3 −1 spec/integration/rspec_spec.rb
View
10 lib/rocket_pants/test_helper.rb
@@ -75,7 +75,15 @@ def have_decoded_response(value)
protected
# Like process, but automatically adds the api version.
- def process(action, parameters = nil, session = nil, flash = nil, http_method = 'GET')
+ def process(action, http_method = 'GET', *args)
+ # Rails 4 changes the method signature. In rails 3, http_method is actually
+ # the paramters.
+ if http_method.kind_of?(String)
+ parameters, session, flash = args
+ else
+ parameters = http_method
+ end
+
response.recycle_cached_body!
parameters ||= {}
if _default_version.present? && parameters[:version].blank? && parameters['version'].blank?
View
4 spec/integration/rspec_spec.rb
@@ -10,6 +10,8 @@ def self.teardown(*args); end
include RocketPants::TestHelper
include RocketPants::RSpecMatchers
+ default_version 1
+
before do
@routes = TestRouter
@controller = TestController.new
@@ -19,7 +21,7 @@ def self.teardown(*args); end
describe 'should have_exposed' do
it "allows you to asset what should have been exposed by an action" do
- get :echo, :echo => "ping", :version => 1
+ get :echo, :echo => "ping"
response.should have_exposed(:echo => "ping")
end
Please sign in to comment.
Something went wrong with that request. Please try again.