##$ bundle exec rspecが実行できない
下記コマンドを実行する際に、
$ bundle exec rspec
Book:pictweet_exam2 YUKI$ bundle exec rspec
Unsupported rails environment for compass
An error occurred while loading ./spec/models/user_spec.rb.
Failure/Error:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable
has_many :tweets
validates :nickname, presence: true, length: { maximum: 6 }
ActiveRecord::AdapterNotSpecified:
'test' database is not configured. Available: ["default", "development"]
# ./app/models/user.rb:1:in `<top (required)>'
# ./config/routes.rb:2:in `block in <top (required)>'
# ./config/routes.rb:1:in `<top (required)>'
# ./config/environment.rb:5:in `<top (required)>'
# ./spec/rails_helper.rb:4:in `require'
# ./spec/rails_helper.rb:4:in `<top (required)>'
# ./spec/models/user_spec.rb:1:in `require'
# ./spec/models/user_spec.rb:1:in `<top (required)>'
No examples found.
Finished in 0.00046 seconds (files took 5.97 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
とのエラーが出てしまう。
もちろんgemはしっかり記述、、bundle installはできている
エラーメッセージの中の、
'test' database is not configured. Available: ["default", "development"]
のが怪しそうと検索、testdatabaseを確認するも、、、
ちゃんとある、、
##database.ymlの確認
testの記述のインデントが問題でした、、
##解決
なんて単純なの、、
でもエラーメッセージにヒントが出てこないので、随分と時間がかかってしまった。
Book:pictweet_exam2 YUKI$ bundle exec rspec
Unsupported rails environment for compass
User
#create
is invalid without a nickname
Finished in 0.00736 seconds (files took 7.8 seconds to load)
1 example, 0 failures