Rails Rspec non default directory structure not recognized

When I add a directory in a Rails project rspec is not able to find the code in it

for example

app/actions
app/assets
app/controllers
app/helpers

code in app/actions is not located however it is outside of Rubymine

7 comments

Hi,

could you please clarify what "rspec is not able to find the code in" means?
Does this mean that rspec test when you run it unable to use classes defined in the new directory or something else?

Regards, Oleg.

0

Exactly

I have

app/actions
    service_dispatcher.rb   <=    containing:  class ServiceDispatcher


Error Message

  NameError: uninitialized constant ServiceDispatcher


error Message from Vim (Command Line)

Failure/Error: expect(ServiceDispatcher).to receive(service)   <= still an error but  ServiceDispatcher is recognized

0

Ok, I think now I known what you mean: it is a runtime exception.
So, next question is how do you run the spec file in RubyMine (just show screenshort of the run configuration),
and how it is executed in command line?

Regards, Oleg.

0

I usual way I run it is just to double click open the the pop and select run or else use ctrl-shift-R  - This may not be the right way to do it but it usually works my config is below.

from the command line I usually use just bundle exec rake or  bundle exec rspec


Screen Shot 2015-02-09 at 10.39.10 PM.png

0

Ok,  could you please try to run "rake rspec" in RubyMine and check if it works correctly.
If it is please try to run something like "bundle exec rspec <rspec-dir>" in command line to see if it works there.

Regards, Oleg.

0

Under the tools menu item - Run Rake task I entered rspec and it would not take it - I put in routes (this is a Rails App) and dit worked perfectly

Under Terminal - this may be a plugin - I entered bundle exec rake and bundle exec rspec and both worked - just plain rake and rspec did not work - it was the same as in my terminal

0

tbrooke wrote:

Under the tools menu item - Run Rake task I entered rspec and it would not take it - I put in routes (this is a Rails App) and dit worked perfectly

usually name of the task is "spec" (not "rspec").
Also if you think that "bundle exec" is important check "Run script in context of the bundle" at Bundler tab of the run configuration and check if it helps.

Regards, Oleg.

0

Please sign in to leave a comment.