Sha256: 597473e6536f69dc24c5d4e35155b590177a7e25b63d4f0d3d5efc02bd3889fc

Contents?: true

Size: 698 Bytes

Versions: 1

Compression:

Stored size: 698 Bytes

Contents

require 'spec_helper'


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

    it 'fails if association does not exist' do
      expect { expect(Book).to belong_to :bad_relation}.to fail_with "expected to belong to bad_relation"
    end
  end

  context '#should_not' do
    it 'fails if association exists' do
      expect { expect(Book).not_to belong_to :author }.to fail_with "expected to not belong to author"
    end
  end

  context 'instance of model' do
    it "should pass" do
      lambda{ expect(Book.new).to belong_to :author}.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/belong_to_spec.rb