&tag(RSpec/トラブルシューティング);
*目次 [#t119f39d]
#contents
*関連ページ [#g2596805]
-[[RSpec]]

*参考情報 [#m4b3dbbe]

*トラブルシューティング [#ob7d9adf]

** 「ActiveModel::MissingAttributeError: can't write unknown attribute `icon`」 [#zc0371af]
-carriewave + factorygirlの環境で実行していたのでどちらかの特有のエラーかと思ったら全く違った。
-test用db定義が古いのが原因。以下で更新できる。[[WARNING: db:test:clone is deprecated. The Rails test helper now maintains your test schema automatically, see the release notes for details.が出た時の対処法 - Qiita:http://qiita.com/razokulover/items/28f7bf7ae64e4f21b097]]
 rake db:test:clone
-spec_helper.rbで以下が定義されていれば自動でメンテナンスされるのだがRailsをバージョンアップした場合抜けていることもあるので確認(逆にdb:test:cloneでdeprecatedと表示されてもspec_helper.rbに以下がないと実行されていない)
 ActiveRecord::Migration.maintain_test_schema!


 

**spec実行時に「`require': cannot load such file -- spec_helper (LoadError)」 [#t6653edb]
-spec_helperを作ってないのかもしれない。以下のコマンドを実行してみる。
 rails generate rspec:install

**spec実行時に「cannot load such file -- rails_helper」 [#ra4d5c37]
-spec_helperじゃなくてrails_helperがないとだめになった。以下のコマンドで作成できる。
 rails generate rspec:install

**describeでエラー発生「syntax error, unexpected keyword_do_block, expecting => (SyntaxError)」 [#h626e9d5]
-describeの書き方が変わったらしい。[[Myron Marston &#187; RSpec 2.99 and 3.0 RC1 have been released!:http://myronmars.to/n/dev-blog/2014/05/rspec-2-99-and-3-0-rc-1-have-been-released]]によると、「Issue a deprecation when described_class is accessed from within a nested describe <SomeClass> example group, since described_class will return the innermost described class in RSpec 3 rather than the outermost described class, as it behaved in RSpec 2. (Myron Marston)」とある。
--以前: 
 describe Simple, :type => :model ,'説明分' do
--以後:
 describe '説明分', :type => :model  do


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS