Sha256: 47a89fb1c21fc5a180de800c300c269992d9c454cca83defe8918c10c376e11d

Contents?: true

Size: 690 Bytes

Versions: 10

Compression:

Stored size: 690 Bytes

Contents

require 'spec_helper'


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

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

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

  context 'instance of model' do
    it "should pass" do
      lambda{ Book.new.should belong_to :author}.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/belong_to_spec.rb
dm-rspec2-0.3.0 spec/dm/matchers/belong_to_spec.rb
dm-rspec-0.2.3 spec/dm/matchers/belong_to_spec.rb
dm-rspec-0.2.2 spec/dm/matchers/belong_to_spec.rb
dm-rspec2-0.2.4 spec/dm/matchers/belong_to_spec.rb
dm-rspec2-0.2.3 spec/dm/matchers/belong_to_spec.rb
dm-rspec2-0.2.2 spec/dm/matchers/belong_to_spec.rb
dm-rspec2-0.2.1 spec/dm/matchers/belong_to_spec.rb
dm-rspec-0.2.1 spec/dm/matchers/belong_to_spec.rb
dm-rspec-0.2.0 spec/dm/matchers/belong_to_spec.rb