Permalink
Browse files

make all features pass

  • Loading branch information...
1 parent e1b7a96 commit cbcfd88dc983340281db20915a80e3831c8f6950 @aslakhellesoy aslakhellesoy committed May 23, 2011
@@ -1,3 +1,4 @@
+require 'cucumber/rails/hooks/active_record'
require 'cucumber/rails/hooks/database_cleaner'
require 'cucumber/rails/hooks/allow_rescue'
require 'cucumber/rails/hooks/mail'
@@ -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
@@ -6,7 +6,6 @@
if defined?(ActiveRecord::Base)
require 'rails/test_help'
- require 'cucumber/rails3/active_record'
else
require 'action_dispatch/testing/test_process'
require 'action_dispatch/testing/integration'
@@ -6,7 +6,3 @@ def self.connection
@@shared_connection || retrieve_connection
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.