Closed jelder closed 11 years ago
If you use Mongoid, then why do you have ActiveRecord loaded? I haven't used Mongoid and don't know if that is needed for Mongoid to work or not.
We use a half dozen other gems which require it, but still function when it's not configured.
On Nov 23, 2012, at 9:32 AM, Jarmo Pertman notifications@github.com wrote:
If you use Mongoid, then why do you have ActiveRecord loaded?
— Reply to this email directly or view it on GitHub.
Can you provide me with the stacktrace? Looking at the code it seems to me that this Exception will be thrown by retrieve_connection
.
If you remove the line 16 (https://github.com/GoBoundless/watir-rspec/blob/ee6454477e353e75c58d7cd91b81b1510a204f49/lib/watir/rspec/active_record_shared_connection.rb#L16) do you still see that error, e.g. is some of your libraries calling Base.connection
?
@jelder can you please provide us more information so we could close this issue once and for all?
@jelder ! :)
@ericdfields do you have the same problem?
@jarmo He does because we work together, and was reminding me to reply :)
If I remove line 16, the error disappears.
Stacktrace for the reference:
ActiveRecord::ConnectionNotEstablished: ActiveRecord::ConnectionNotEstablished
from C:/bin/Ruby193-p374/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_pool.rb:410:in `retrieve_connection'
from C:/bin/Ruby193-p374/lib/ruby/gems/1.9.1/gems/activerecord-3.2.11/lib/active_record/connection_adapters/abstract/connection_specification.rb:171:in `retrieve_connection'
from (irb):3
from C:/bin/Ruby193-p374/bin/irb:12:in `<main>'
Thanks for your pull request. I've implemented it a little bit differently by having the shared connection to be set lazily. I've also used a mutex just in case.
Sorry for it taking so long.
This patch prevents watir-rspec from failing when ActiveRecord has been removed (for instance, when using Mongoid).