Sha256: a44430cddeba9d5500949d6bb72e50b60f24fba3b88ef8a7095d25b6736ff007

Contents?: true

Size: 789 Bytes

Versions: 10

Compression:

Stored size: 789 Bytes

Contents

require 'spec_helper'


describe DataMapper::Matchers::HaveManyAndBelongTo do
  context '#should' do
    it 'passes if association exists' do
      lambda { Book.should have_many_and_belong_to :genres}.should_pass
    end

    it 'fails if association does not exist' do
      lambda { Book.should have_many_and_belong_to :authors}.
        should fail_with "expected to have many and belong to authors"
    end
  end

  context '#should_not' do
    it 'fails if association exists' do
      lambda { Genre.should_not have_many_and_belong_to :books}.
        should fail_with "expected to not have many and belong to books"
    end
  end

  context 'instance of model' do
    it "should pass" do
      lambda{ Book.new.should have_many_and_belong_to :genres}.should_pass
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
dm-rspec-0.2.4 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec2-0.3.0 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec-0.2.3 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec-0.2.2 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec2-0.2.4 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec2-0.2.3 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec2-0.2.2 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec2-0.2.1 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec-0.2.1 spec/dm/matchers/have_many_and_belong_to_spec.rb
dm-rspec-0.2.0 spec/dm/matchers/have_many_and_belong_to_spec.rb