Sha256: 7438c0d7f205bfc467d8b7977bb8fb9269033401f5dad3615b865cf9026ef9d9

Contents?: true

Size: 539 Bytes

Versions: 1

Compression:

Stored size: 539 Bytes

Contents

require 'spec_helper'

describe DataMapper::Matchers::HaveOne do
  context '#should' do
    it 'passes if association exists' do
      lambda { Book.should have_one :foreword}.should_pass
    end

    it 'fails if association does not exist' do
      lambda { Author.should have_one :book}.should fail_with "expected to have one book"
    end
  end

  context '#should_not' do
    it 'fails if association exists' do
      lambda { Book.should_not have_one :foreword}.should fail_with "expected not to have one foreword"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dm-rspec-0.1.2 spec/dm/matchers/have_one_spec.rb