small medium large xlarge

Back to: All Forums  Take My Money
10 Apr 2017, 17:45
Noel Rappin (48 posts)

Either a) the snippet in the book is not meant to be the entire file, or b) it only works in my code because I run the entire suite, so the rails helper file is already loaded. (This is off the top of my head, I’m not looking at the book right now.)

10 Apr 2017, 17:59
Rails Engineer (11 posts)

Running the individual test in isolation in the author’s working project results in success:

rspec spec/features/visitors/home_page_spec.rb

However, performing the same operation in my project fails:

home/rails/01/spec/features/visitors/home_page_spec.rb:4:in <top (required)>': undefined method feature’ for main:Object (NoMethodError)

What configuration is missing from my project?

10 Apr 2017, 17:54
Noel Rappin (48 posts)

Oh, I bet it’s the .rspec file.

Mine looks like this:

--require spec_helper
--require rails_helper

The last two lines trigger a require for each file even if it’s not listed in the file.


10 Apr 2017, 17:57
Rails Engineer (11 posts)

Status: Solved. Thank you, Noel.

You must be logged in to comment