Ruby on Rails: /bin/sh: rspec: command not found

前端 未结 8 634
情话喂你
情话喂你 2020-12-31 08:20

I\'m currently going through Michael Hartl\'s RoR tutorial and am stuck on Chapter 3 when trying to run Spork and Guard. When trying to run tests I get:

/bin/s

相关标签:
8条回答
  • 2020-12-31 08:56

    For anybody using rbenv, there is also this setting in rubyTest.sublime-settings which will do the trick:

    "check_for_rbenv": true
    
    0 讨论(0)
  • 2020-12-31 08:58

    I spent many hours struggling with this same problem! I could not get rspec to run within Sublime Text 2, using the Michael Hartl "Ruby on Rails Tutorial." It kept saying

    /bin/sh: rspec: command not found
    

    I finally realized that the RubyTest package was looking in the WRONG PLACE for my RVM!

    On my Mac, the path for RubyTest is /Library/Application Support/Sublime Text 2/Packages/Ruby Test

    First, to make RubyTest seek the RVM, I changed the parameter in RubyTest.sublime-settings from

    "check_for_rvm": false, to "check_for_rvm": true,

    Then I dug into the Python code of run_ruby_test.py.

    At line 151, inside class BaseRubyTask, it had the wrong path for my RVM:

    rvm_cmd = os.path.expanduser('~/.rvm/bin/rvm-auto-ruby')
    

    I changed it to the full correct path:

    rvm_cmd = os.path.expanduser('/usr/local/rvm/bin/rvm-auto-ruby')
    

    If this is not your path, find the correct path by typing which rvm-auto-ruby and substitute that instead.

    After saving run_ruby_test.py, I went to Terminal, cd to my Rails application directory, and ran spork

    Finally, I opened static_pages_spec.rb in Sublime Text 2. Now all the tests work from it!

    0 讨论(0)
提交回复
热议问题