Sha256: 30937d12831334b3b128eb2afa0ec38e708de4dc09d8d70ca7612bf69f6e5ce9

Contents?: true

Size: 917 Bytes

Versions: 2

Compression:

Stored size: 917 Bytes

Contents

require 'spec_helper'


describe DataMapper::Matchers::HaveErrorsOn do
  before(:all) do
    @invalid = Book.new
    @valid = Book.new(:name => 'War and Peace')
  end


  context '#should' do
    it 'passes for invalid model' do
      lambda {@invalid.should have_errors_on :name}.should_pass
      lambda {@invalid.should have_error_on :name}.should_pass
    end

    it 'fails for valid model' do
      lambda {@valid.should have_errors_on :name}.should fail_with "expected to have errors on name"
      lambda {@valid.should have_error_on :name}.should fail_with "expected to have errors on name"
    end
  end

  context '#should_not' do
    it 'fails for invalid model' do
      lambda {@invalid.should_not have_errors_on :name}.should fail_with "expected to not have errors on name"
      lambda {@invalid.should_not have_error_on :name}.should fail_with "expected to not have errors on name"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-rspec-0.0.2 spec/dm/matchers/have_errors_on_spec.rb
dm-rspec-0.0.1 spec/dm/matchers/have_errors_on_spec.rb