I have the following code inside most of my tests:
describe \'index\'
let(:company) { FactoryGirl.create(:company) }
let(:user) { FactoryGirl.create(:user,
I'm not sure what you mean by "this" in "what is the correct way of doing this"? Accessing let
and subject
within a before(:all)
is deprecated and will be removed in RSpec 3 with the following explanation from https://github.com/rspec/rspec-core/pull/857:
let
andsubject
declarations are not intended to be called in abefore(:all)
hook, as they exist to define state that is reset between each example, whilebefore(:all)
exists to define state that is shared across examples in an example group.