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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -