0

I just updated my gems (Including rails to 4.1). I ran guard and everything worked fine. Then I created a new model and ran guard again. This time in the console everything looks good but the guard notification says Rspec results failed! I opened the spec of the newly created model (its empty) and just save it without changing. Then in the console i can see the following error :

    10:40:15 - INFO - Guard is now watching at '/home/pubudu/Projects/sumaga-asapuwa'
    10:43:55 - INFO - Running: spec/models/dcache_spec.rb
    /home/pubudu/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load': cannot load such file -- /home/pubudu/Projects/sumaga-asapuwa.bk/spec/models/dcache_spec.rb (LoadError)
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `each'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/configuration.rb:896:in `load_spec_files'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/command_line.rb:22:in `run'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:80:in `run'
        from /home/pubudu/.rvm/gems/ruby-2.1.1/gems/rspec-core-2.14.8/lib/rspec/core/runner.rb:17:in `block in autorun'
        from /home/pubudu/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from /home/pubudu/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from -e:1:in `<main>'
    [1] guard(main)> 

Any idea how to fix this?

2
  • 1
    Please share both the model and spec file. Commented Apr 19, 2014 at 7:58
  • doesn't sound like it's empty; sounds like it doesn't exist (hence the error) Commented Apr 19, 2014 at 8:10

1 Answer 1

1

Guard is watching the directory /home/pubudu/Projects/sumaga-asapuwa but it is trying to run a spec file in /home/pubudu/Projects/sumaga-asapuwa.bk/spec/models (i.e. with an extra .bk on the folder name.

In the rspec section of your Guardfile you should have a line like:

watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }

This is in the instruction to Guard that if a .rb file under the app directory changes, or is created, to run rspec on the corresponding spec file. This is defined to be relative to the directory Guard is watching.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks it worked! I removed the other directory and it worked :D

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.