Sha256: 9273f828fb8ec49f64eab792d35381f3f418bdc6b62b0e514ab49c3cdab73ed7

Contents?: true

Size: 766 Bytes

Versions: 3

Compression:

Stored size: 766 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
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dm-rspec-0.1.2 spec/dm/matchers/have_many_through_spec.rb
dm-rspec-0.1.1 spec/dm/matchers/have_many_through_spec.rb
dm-rspec-0.1.0 spec/dm/matchers/have_many_through_spec.rb