I've seen tons of these questions, but none of their solutions are working for me. I have a single test like so:
describe RolesController do
describe "#delet" do
context "When the user is logged in" do
let(:user) {FactoryGirl.create(:user)}
let(:admin) {FactoryGirl.create(:admin)}
let(:adminRole) {FactoryGirl.create(:adminRole)}
it "Should allow admins to delete roles" do
sign_in admin
put :destroy, :id => adminRole.id
end
end
end
end
Simple, simple, simple. Yet I get the typical error:
1) RolesController#delet When the user is logged in Should allow admins to delete roles
Failure/Error: Unable to find matching line from backtrace
SystemStackError:
stack level too deep
# /home/adam/.rvm/gems/ruby-2.0.0-p247/gems/activesupport-4.0.0/lib/active_support/notifications/instrumenter.rb:23
and I'm all like ... what? Again I have read dozens of questions on this and it seems to be something with factory girl but I cannot see what the issue here would be. I have tons of other tests that instantiate factory girl based object like this with no issue.
Simply do not use the variable you are defining with let
inside the following code block as it triggers an endless recursion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With