简体   繁体   中英

ActsAsTenant current_tenant + Capybara + RSpec testing

I am trying to create an integration test with Capybara/RSpec that has a valid current_user (using the Warden.test_mode! trick) and I have also created a valid current_tenant by doing this in the test:

ActsAsTenant.current_tenant = Account.first

When the test is ran it comes up with a "undefined method for nil:NilClass" error that is characteristic of the current_tenant not being set. I have verified that Account.first does in fact have what I expect in it.

What might be the problem and how can I fix it?

您可以在此处查看gem'act_as_tent'文档https://github.com/ErwinM/acts_as_tenant#testing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM