Search code examples
ruby-on-railsrspecguard

Rspec method not found when using model subfolders


Hello i am receiving this error:

spec/models/stores/persistent_spec.rb:6:in block (2 levels) in <top (required)>': undefined methodexpect' for # (NoMethodError)

Here is my setup. i have a class called Store located inside app/models

i have a class called Stores::Temporary < Store placed inside app/models/stores

I am trying to write tests for Temporary and they are failing with the error above

i have created temporary_spec.rb inside spec/models/stores and the code for it is the following:

require "spec_helper"

describe Stores::Temporary do

end

i am trying to write an expect to raise_error statement.

I have also tried 5.should == 5 which results with no available test being detected inside this file. I am using guard to autorun the tests, so changes in the files are being detected (works correctly) and tests are rerun but appear as blank.


Solution

  • So after struggling with this for 2 hours i restarted the PC and it was working without changing anything... One of those stupid errors you just need to sorta sleep-over and retry.