Skip to content

Commit

Permalink
make all features pass
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed May 23, 2011
1 parent e1b7a96 commit cbcfd88
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions lib/cucumber/rails/hooks.rb
Original file line number Original file line Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'cucumber/rails/hooks/active_record'
require 'cucumber/rails/hooks/database_cleaner' require 'cucumber/rails/hooks/database_cleaner'
require 'cucumber/rails/hooks/allow_rescue' require 'cucumber/rails/hooks/allow_rescue'
require 'cucumber/rails/hooks/mail' require 'cucumber/rails/hooks/mail'
14 changes: 14 additions & 0 deletions lib/cucumber/rails/hooks/active_record.rb
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,14 @@
if defined?(ActiveRecord::Base)
require 'cucumber/rails3/active_record'

Before('@javascript') do
# Forces all threads to share the same connection. This works on
# Capybara because it starts the web server in a thread.
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
end

Before('~@javascript') do
# Do not use a shared connection unless we're in a @javascript scenario
ActiveRecord::Base.shared_connection = nil
end
end
1 change: 0 additions & 1 deletion lib/cucumber/rails3.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@


if defined?(ActiveRecord::Base) if defined?(ActiveRecord::Base)
require 'rails/test_help' require 'rails/test_help'
require 'cucumber/rails3/active_record'
else else
require 'action_dispatch/testing/test_process' require 'action_dispatch/testing/test_process'
require 'action_dispatch/testing/integration' require 'action_dispatch/testing/integration'
Expand Down
4 changes: 0 additions & 4 deletions lib/cucumber/rails3/active_record.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,7 +6,3 @@ def self.connection
@@shared_connection || retrieve_connection @@shared_connection || retrieve_connection
end end
end end

# Forces all threads to share the same connection. This works on
# Capybara because it starts the web server in a thread.
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection

0 comments on commit cbcfd88

Please sign in to comment.