Skip to content

Commit

Permalink
Add back descendants iteration. Update History.
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed Sep 25, 2011
1 parent 30e5e36 commit 4e90fe0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
15 changes: 10 additions & 5 deletions History.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)

Expand Down
16 changes: 11 additions & 5 deletions lib/cucumber/rails/hooks/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

@ClayShentrup
Copy link

Choose a reason for hiding this comment

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

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.