Error message of "rake" command:「`block in non_options': file not found: environment (ArgumentError)」
在前一篇有使用到了 shoulda 這個 gem lib 來幫助測試。Shoulda 有一個 open issue 是尚未解決的,這個 bug 會使得執行 rake 相關指令時出現下列錯誤訊息:
$ rake environment /Users/<username>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: routes (ArgumentError) from /Users/<username>/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:146:in `map!' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:146:in `non_options' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:207:in `non_options' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:52:in `process_args' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/minitest/unit.rb:884:in `run' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:21:in `run' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:27:in `run_once' from /Users/<username> /.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
Shoulda 很久沒人維護了~
建議把 shoulda 依需求換成 shoulda-matchers 或者 shoulda-contex 即可解決這個問題
Shoulda 最後也就是用了 shoulda-matchers 或 shoulda-context,可以就直接使用原本的 gem
留言
張貼留言