1. pugiemonn

    Posted

    pugiemonn
Changes in title
+rspecを実行した時にcannot load such file -- spec_helper (LoadError)と言われる解決方法
Changes in tags
Changes in body
Source | HTML | Preview
@@ -0,0 +1,20 @@
+rspecを実行したらspec_helperが無いというエラーがでました。
+
+```
+bundle exec rspec spec/models/event_spec.rb
+/var/www/html/pugiemonn.com/spec/models/event_spec.rb:23:in `require': cannot load such file -- spec_helper (LoadError)
+ from /var/www/html/pugiemonn.com/spec/models/event_spec.rb:23:in `<top (required)>'
+ from /home/vagrant/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
+```
+rspec:installをすればいいみたいです。
+
+```bash:generateコマンドを実行
+rails generate rspec:install
+ create .rspec
+ exist spec
+ create spec/spec_helper.rb
+ create spec/rails_helper.rb
+```
+
+# 参考
+http://stackoverflow.com/questions/25800122/error-when-trying-to-run-rspec-require-cannot-load-such-file-rails-helper