Sha256: 66476e9e73f1e992376a0ba4d95a0fdd5b8ffc6ac278ee8d8b5c44761a43f90d

Contents?: true

Size: 1.79 KB

Versions: 11

Compression:

Stored size: 1.79 KB

Contents

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

describe Remarkable::DSL::Assertions do
  subject { [1, 2, 3] }

  before(:each) do
    @matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, 2, 3)
  end

  it 'should provide default structure for assertions' do
    should collection_contain(1)
    should collection_contain(1, 2)
    should collection_contain(1, 2, 3)

    should_not collection_contain(4)
    should_not collection_contain(1, 4)
  end

  it 'should provide default structure for single assertions' do
    should single_contain(1)
    should_not single_contain(4)
    nil.should_not single_contain(1)
  end

  it 'should provide collection in description' do
    @matcher.description.should == 'contain 1, 2, and 3'
  end

  it 'should provide value to expectation messages' do
    @matcher.matches?([4])
    @matcher.failure_message.should == 'Expected that 1 is included in [4]'
  end

  it 'should accept blocks as argument' do
    should_not single_contain(4)
    should single_contain(4){ self << 4 }
  end

  it 'should provide an interface for default_options hook' do
    matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1, :args => true)
    matcher.instance_variable_get('@options').should == { :working => true, :args => true }
  end

  it 'should provide an interface for after_initialize hook' do
    matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
    matcher.instance_variable_get('@after_initialize').should be_true
  end

  it 'should provide an interface for before_assert hook' do
    matcher = Remarkable::Specs::Matchers::CollectionContainMatcher.new(1)
    [1, 2, 3].should matcher
    matcher.instance_variable_get('@before_assert').should be_true
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
remarkable-3.1.7 spec/dsl/assertions_spec.rb
remarkable-3.1.8 spec/dsl/assertions_spec.rb
remarkable-3.0.9 spec/dsl/assertions_spec.rb
remarkable-3.0.10 spec/dsl/assertions_spec.rb
remarkable-3.1.5 spec/dsl/assertions_spec.rb
remarkable-3.1.6 spec/dsl/assertions_spec.rb
remarkable-3.1.3 spec/dsl/assertions_spec.rb
remarkable-3.1.0 spec/dsl/assertions_spec.rb
remarkable-3.1.1 spec/dsl/assertions_spec.rb
remarkable-3.1.2 spec/dsl/assertions_spec.rb
remarkable-3.1.4 spec/dsl/assertions_spec.rb