Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add back descendants iteration. Update History.

  • Loading branch information...
commit 4e90fe0afdbd356159f59d3d65b4ce289602a342 1 parent 30e5e36
@aslakhellesoy aslakhellesoy authored
Showing with 21 additions and 10 deletions.
  1. +10 −5 History.md
  2. +11 −5 lib/cucumber/rails/hooks/active_record.rb
View
15 History.md
@@ -1,3 +1,8 @@
+## In Git
+
+### Bugfixes
+* Fix deprecation warnings ([#169](https://github.com/cucumber/cucumber-rails/issues/169), [#170](https://github.com/cucumber/cucumber-rails/pull/170) Micah Geisel)
+
## [v1.0.5](https://github.com/cucumber/cucumber-rails/compare/v1.0.4...v1.0.5)
### Bugfixes
@@ -12,11 +17,11 @@
### Bugfixes
* sqlite3-ruby is now sqlite3 ([#158](https://github.com/cucumber/cucumber-rails/pull/158) Trung Le)
-* Broken link in the USAGE file of the features generator ((#156)[https://github.com/cucumber/cucumber-rails/pull/156] Pablo Alonso García)
-* Rails destroy cucumber:feature deletes the steps folder, even though it's not empty. ((#154)[https://github.com/cucumber/cucumber-rails/pull/154], (#111)[https://github.com/cucumber/cucumber-rails/issues/111] mblake)
-* Adjust select_date, select_time xpaths so they work when scoped in the document ((#151)[https://github.com/cucumber/cucumber-rails/pull/151] Thomas Walpole)
-* Extend javascript emulation to handle rails CSRF protection ((#164)[https://github.com/cucumber/cucumber-rails/pull/164] Jonathon M. Abbott)
-* Add steps for finding fields with errors ((#162)[https://github.com/cucumber/cucumber-rails/pull/162] Mike Burns)
+* Broken link in the USAGE file of the features generator ([#156](https://github.com/cucumber/cucumber-rails/pull/156) Pablo Alonso García)
+* Rails destroy cucumber:feature deletes the steps folder, even though it's not empty. ([#154](https://github.com/cucumber/cucumber-rails/pull/154]), [#111](https://github.com/cucumber/cucumber-rails/issues/111) mblake)
+* Adjust select_date, select_time xpaths so they work when scoped in the document ([#151](https://github.com/cucumber/cucumber-rails/pull/151) Thomas Walpole)
+* Extend javascript emulation to handle rails CSRF protection ([#164](https://github.com/cucumber/cucumber-rails/pull/164) Jonathon M. Abbott)
+* Add steps for finding fields with errors ([#162](https://github.com/cucumber/cucumber-rails/pull/162) Mike Burns)
## [v1.0.2](https://github.com/cucumber/cucumber-rails/compare/v1.0.1...v1.0.2)
View
16 lib/cucumber/rails/hooks/active_record.rb
@@ -8,14 +8,20 @@ def self.connection
end
Before('@javascript') do
- # Forces all threads to share a connection on a per-model basis,
- # as connections may vary per model as per establish_connection. This works
- # on Capybara because it starts the web server in a thread.
- ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
- end
+ # Forces all threads to share a connection on a per-model basis,
+ # as connections may vary per model as per establish_connection. This works
+ # on Capybara because it starts the web server in a thread.
+ ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
+ ActiveRecord::Base.descendants.each do |model|
+ model.shared_connection = model.connection
+ end
+ end
Before('~@javascript') do
# Do not use a shared connection unless we're in a @javascript scenario
ActiveRecord::Base.shared_connection = nil
+ ActiveRecord::Base.descendants.each do |model|
+ model.shared_connection = nil
+ end
end
end

1 comment on commit 4e90fe0

@brokenladder

Why did you add back in the descendants iteration? I see this line above:

class_attribute :shared_connection

Which leads me to believe that this iteration code is just re-setting the same value over and over again for no reason. This commit only would make sense to me if this code still used class_inheritable_attribute.

Thanks.

Please sign in to comment.
Something went wrong with that request. Please try again.