ruby on rails - has_many and belongs_to assertion in MiniTest using Mongoid -
i use mongoid database , have 2 models below. couldn't assert has_many , belongs_to relationship. can assert relations in minitest.
event.rb
class event include schizo::data include mongoid::document field :name field :start_at field :finish_at field :status field :location has_many :participations end
participation.rb
class participation include mongoid::document belongs_to :event belongs_to :participant end
consider using mongoid-minitest
gem that. see details here
your specs following then:
describe event subject { event } { must have_many(:participations) } end describe participation subject { participation } { must belong_to(:participations) } end
Comments
Post a Comment