In my spec/models/user_spec.rb I have the next:
require 'spec_helper'
describe User do
before { 5.times { FactoryGirl.create(:sport) } }
before { let(:user) { FactoryGirl.create(:user) } }
...
end
But when running my user_spec.rb I’m getting this error:
Failure/Error: before { let(:user) { FactoryGirl.create(:user) } }
NoMethodError:
undefined method `let' for #<RSpec::Core::ExampleGroup::Nested_1:0x000001043033b0>
Which is weird because my specs have been working until now, and I haven’t changed anything…
Here is my gemfile: https://gist.github.com/4690919
Here is my spec_helper.rb: https://gist.github.com/4690935
I’d appreciate any help, thanks
I don’t know why it was working before, but you should never have a
letblock inside of abeforeblock. It should be called from within adescribe(orcontext) block, like this:See the documentation for details.