Shoulda
次のようにユーザークラスをテストするために使用しようとしています:
user_test.rb
require 'test_helper'
include Devise::TestHelpers
class UserTest < Test::Unit::TestCase
should have_many(:holidays)
should have_many(:hopsital_bookings)
should have_and_belong_to_many(:roles)
should belong_to(:hospital)
end
ユーザー.rb
belongs_to :hospital
belongs_to :department
has_many :holidays
has_many :hospital_bookings
has_and_belongs_to_many :roles
実行するrake test
と、次の出力が得られます: Imgur。
ここで何が欠けているのか、なぜこれが機能しないのかについてのアイデアはありません。