Open its-fern opened 4 days ago
This happens because of a bug introduced in RSpec v6.1.3. Temporarily locking your Gemfile to = 6.1.2
will work around it for now. I've submitted https://github.com/rspec/rspec-rails/issues/2773 with more information and an example test case.
This happens because of a bug introduced in RSpec v6.1.3. Temporarily locking your Gemfile to
= 6.1.2
will work around it for now. I've submitted rspec/rspec-rails#2773 with more information and an example test case.
Amazing, thanks @pond!
@its-fern Unfortunately things were going really well until a dev stepped in and seems to say that this bug is minor; we're holding it wrong by using hooks as they've been documented in RSpec. I'm not sure I agree, but you well might. Please could you check Jon Rowe's comment and vote accordingly? If ultimately I'm in the minority in my assessment of what should be done here, then of course, the community wins.
EDITED TO ADD: They're still interested in a resolution PR, so I'll work on that today (NZ time).
Currently running ActsAsTenant v
1.0.1
on a Rails 7.1 app. We use rspec for testing and recently upgradedrspec-rails
from6.1.2
to6.1.3
. We started running intoNoTenantSet
errors on this upgrade when we were not before.For some context, we have a helper set up that allows devs to include a tag in the rspec context to disable the tenant check:
Devs can then write specs that ignore the tenant check like so:
I did some digging and I think this might be related to this PR https://github.com/rspec/rspec-rails/pull/2752 (full changelog here). The
ActsAsTenant.unscoped?
flag is being reset somehow (confirmed this by stepping through the code) so this code block raises:https://github.com/ErwinM/acts_as_tenant/blob/7e3bd8a534f309061a9c34b4ed3eb3576e2e065d/lib/acts_as_tenant/model_extensions.rb#L20-L22
Any help is appreciated here, and I'm happy to provide more info where I can!