Sha256: 9de8a26869e249b9e12f976e46f4d6acd80ea012db3d1131ab9f7f037a7c74f4

Contents?: true

Size: 797 Bytes

Versions: 1

Compression:

Stored size: 797 Bytes

Contents

require 'spec_helper'


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

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

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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-rspec-0.3.0 spec/dm/matchers/have_many_and_belong_to_spec.rb