0
$ Rspec spec/models/user_spec.rb
/usr/local/rvm/gems/ruby-2.3.1/gems/rspec-core-3.4.4/lib/rspec/core/configuration.rb:1361:
in `load': /Users/Tish/Projects/trainer-project/spec/models/user_spec.rb:14:
syntax error, unexpected tIDENTIFIER, expecting keyword_end (SyntaxError)
はuser_spec.rbです:私はユーザーのためにテストを書いていて、このエラーを取得しています:ここ
require 'rails_helper'
RSpec.describe User, type: :model do
it "requires a name" do
John = User.new(name: nil, email: '[email protected]', password: 'password')
expect(John).not_to_be_valid
expect(John.errors[:name].any?).to_be_truthy
end
これらの行にエラーメッセージのポイントを、それは「末端」を期待していますが、最後はそこにあると言ってdocsパー...
it "requires an email" do
John = User.new(name: 'John', email: nil, password: 'password')
expect(John).not_to_be_valid
expect(John.errors[:email].any?)to_be_truthy
end
it "requires a password" do
John = User.new(name: 'John', email: '[email protected]', password: nil)
expect(John).not_to_be_valid
expect(John.errors[:password].any?)to_be_truthy
end
end
'to_be_truthy'の前のドットがありませんか? 'expect(John.errors [:email] .any?)。to_be_truthy'です。 –