Skip to content

Commit

Permalink
Support both Rails 2 and Rails 3
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Feb 24, 2010
1 parent e6ed2cd commit dba9a04
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/capybara/rails.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@

Capybara.app = Rack::Builder.new do
map "/" do
ActionDispatch::Static
run Rails.application
if Rails.version.to_f >= 3.0
ActionDispatch::Static

This comment has been minimized.

Copy link
@jacquescrocker

jacquescrocker Jun 13, 2010

Shouldn't this be use ActionDispatch::Static??

This comment has been minimized.

Copy link
@jnicklas

jnicklas Jun 13, 2010

Collaborator

Ehh, yeah, that actually looks wrong :S

This comment has been minimized.

Copy link
@aslakhellesoy

aslakhellesoy Jun 22, 2010

Author Contributor

I got the fix from someone else - don't remember whom. I haven't seen any error related to this, but then again I haven't used Rails3 much, except for at a tutorial at RailsConf with 100 people where this app worked fine: http://github.com/dchelimsky/railsconf2010-app

run Rails.application
else # Rails 2
use Rails::Rack::Static
run ActionController::Dispatcher.new
end
end
end.to_app

Expand Down

1 comment on commit dba9a04

@jpartogi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rails 3.0.0.beta4 throw this error:
wrong number of arguments (1 for 2) (ArgumentError) wrong number of arguments (1 for 2) (ArgumentError) vendor/gems/rack-1.1.0/lib/rack/builder.rb:54:innew'
vendor/gems/rack-1.1.0/lib/rack/builder.rb:54:in block in use' vendor/gems/rack-1.1.0/lib/rack/builder.rb:73:incall'
vendor/gems/rack-1.1.0/lib/rack/builder.rb:73:in block in to_app' vendor/gems/rack-1.1.0/lib/rack/builder.rb:73:ineach'
vendor/gems/rack-1.1.0/lib/rack/builder.rb:73:in inject' vendor/gems/rack-1.1.0/lib/rack/builder.rb:73:into_app'
vendor/gems/rack-1.1.0/lib/rack/builder.rb:63:in map' vendor/gems/rack-1.1.0/lib/rack/builder.rb:66:inmap'
vendor/bundler/gems/capybara-f47214fa54f8dae1ca782e48ee86d54cdb2dc0b3-master/lib/capybara/rails.rb:5:in block in <top (required)>' vendor/gems/rack-1.1.0/lib/rack/builder.rb:46:ininstance_eval'
vendor/gems/rack-1.1.0/lib/rack/builder.rb:46:in initialize' vendor/bundler/gems/capybara-f47214fa54f8dae1ca782e48ee86d54cdb2dc0b3-master/lib/capybara/rails.rb:4:innew'
vendor/bundler/gems/capybara-f47214fa54f8dae1ca782e48ee86d54cdb2dc0b3-master/lib/capybara/rails.rb:4:in <top (required)>' vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:212:inrequire'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:212:in block in require' vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:200:inload_dependency'
vendor/bundler/gems/rails-16a5e918a06649ffac24fd5873b875daf66212ad-master/activesupport/lib/active_support/dependencies.rb:212:in require' features/support/env.rb:6:in<top (required)>'
vendor/gems/cucumber-0.8.3/lib/cucumber/rb_support/rb_language.rb:141:in require' vendor/gems/cucumber-0.8.3/lib/cucumber/rb_support/rb_language.rb:141:inload_code_file'
vendor/gems/cucumber-0.8.3/lib/cucumber/step_mother.rb:84:in load_code_file' vendor/gems/cucumber-0.8.3/lib/cucumber/step_mother.rb:76:inblock in load_code_files'
vendor/gems/cucumber-0.8.3/lib/cucumber/step_mother.rb:75:in each' vendor/gems/cucumber-0.8.3/lib/cucumber/step_mother.rb:75:inload_code_files'
vendor/gems/cucumber-0.8.3/lib/cucumber/cli/main.rb:53:in execute!' vendor/gems/cucumber-0.8.3/lib/cucumber/cli/main.rb:25:inexecute'
vendor/gems/cucumber-0.8.3/bin/cucumber:8:in <top (required)>'

Please sign in to comment.