can't run rails console commands

I'm trying to figure out how to run a command like...

 

$ bundle exec rspec spec/requests/static_pages_spec.rb


I tried to go to Tools>Run Rails Console.  When typing this in I get the following error.

Loading development environment (Rails 3.2.11)
Switch to inspect mode.
>> bundle exec rspec spec/requests/static_pages_spec.rb
NameError: undefined local variable or method `spec' for main:Object
 from (irb):1
 from /home/geoff/.rvm/gems/ruby-1.9.3-p327@global/gems/railties-3.2.11/lib/rails/commands/console.rb:47:in `start'
 from /home/geoff/.rvm/gems/ruby-1.9.3-p327@global/gems/railties-3.2.11/lib/rails/commands/console.rb:8:in `start'
 from /home/geoff/.rvm/gems/ruby-1.9.3-p327@global/gems/railties-3.2.11/lib/rails/commands.rb:41:in `<top (required)>'
 from /home/geoff/RubymineProjects/sample_app/script/rails:6:in `require'
 from /home/geoff/RubymineProjects/sample_app/script/rails:6:in `<top (required)>'
 from -e:1:in `load'
 from -e:1:in `<main>'



Is there something I need to set up so I can run rails commands in the rails console?  Thanks.
4 comments

As far as I can see you just want to run rspec test, so you do not need to run rails console for this.
I'd suggest to read help topic on running tests (http://www.jetbrains.com/ruby/webhelp/running-tests.html)

Hope this helps, Oleg.

0

Perhaps this isn't the greatest example.  Yes, I'm just running an rspec.  However, there have been other rails commands that I've read in a tutorial to run at the rails command.  I get similar results when I try to do this - errors.  Regardless of what I'm trying to do, is it not possible to run the rspec with the command in rubymine?

0

Hi,

it is possible to run any ruby script from RM, you just need to (manually) create apropriate run configuration for this.
But RM does provide shortcuts for some commands.  I.e. for rspec or cucumber you could use run test functionality (in rspec case it is almost the same as "bundle exec rspec ...").
It is also possible to run rake tasks or rails generators.
So, if you need guidelines on how to manually create something similar I will be happy to help,
but before reinventing the wheel it would be interesting to know what other commands you want to run.

Regards, Oleg.

0

Thanks.  I'm going through a tutorial to learn rails and I've just noticed a few times when it said to run something like the rspec that I'd get errors.  I'll make a note to post them here as I run into them in the future and hopefully get a better handle on how it works with rubymine.  Thanks.

0

Please sign in to leave a comment.