Sha256: 4b31c1fcb68c853dd8d3abe283a9d49ee9ad45649ffbbf2e0175a72516558b3b
Contents?: true
Size: 917 Bytes
Versions: 10
Compression:
Stored size: 917 Bytes
Contents
require 'spec_helper' describe DataMapper::Matchers::HaveManyThrough do context '#should' do it 'passes if association exists' do lambda { Book.should have_many(:tags).through(:taggings) }.should_pass end it 'fails if association does not exist' do lambda { Author.should have_many(:books).through(:something) }.should fail_with "expected to have many books through something" lambda { Book.should have_many(:tags).through(:author) }.should fail_with "expected to have many tags through author" end end context '#should_not' do it 'fails if association exists' do lambda { Book.should_not have_many(:tags).through(:taggings) }.should fail_with "expected to not have many tags through taggings" end end context 'instance of model' do it "should pass" do lambda{ Book.new.should have_many(:tags).through(:taggings)}.should_pass end end end
Version data entries
10 entries across 10 versions & 2 rubygems