Sha256: b9ac5e7e9b07715c15fc860de59562e18fe680cea524cc1070d2b5ec3c69d243

Contents?: true

Size: 913 Bytes

Versions: 8

Compression:

Stored size: 913 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')

describe 'validate_presence_of' do
  subject do
    Article.new
  end
  
  describe 'messages' do
    
    it 'should contain a description' do
      matcher = validate_presence_of(:title, :body)
      matcher.description.should == 'require title and body to be set'
    end

    it 'should set allow_nil? message' do
      matcher = validate_presence_of(:body)
      matcher.matches?(subject)
      matcher.failure_message.should == 'Expected Article to require body to be set'
      matcher.negative_failure_message.should == 'Did not expect Article to require body to be set'
    end
    
  end

  describe 'matchers' do
    it { should validate_presence_of(:title) }
    it { should_not validate_presence_of(:body) }
  end

  describe 'macros' do
    should_validate_presence_of(:title)
    should_not_validate_presence_of(:body)
  end
end

Version data entries

8 entries across 8 versions & 4 rubygems

Version Path
yeastymobs-remarkable_mongomapper-0.0.1 spec/matchers/validate_presence_of_matcher_spec.rb
yeastymobs-remarkable_mongomapper-0.1.0 spec/matchers/validate_presence_of_matcher_spec.rb
yeastymobs-remarkable_mongomapper-0.1.1 spec/matchers/validate_presence_of_matcher_spec.rb
remarkable_mongo-0.1.4 spec/matchers/validate_presence_of_matcher_spec.rb
remarkable_mongo-0.1.3 spec/matchers/validate_presence_of_matcher_spec.rb
remarkable_mongo_ign-0.1.2 spec/matchers/validate_presence_of_matcher_spec.rb
ippy04-remarkable_mongo-0.1.3 spec/matchers/validate_presence_of_matcher_spec.rb
remarkable_mongo-0.1.2 spec/matchers/validate_presence_of_matcher_spec.rb