Sha256: eebaeec40af461f202fb23af66f2ebbabc064b1a9079f29fcd20ce0905674056

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

require 'orangutan'

module Orangutan
  describe Expectation do
    before do
      @e = Expectation.new.receives(:foo)
    end
  
    it 'should not match when method is different' do
      @e.matches?(:bar).should == false
    end
  
    it 'should match when method matches and args are unspecified' do
      @e.matches?(:foo).should == true
    end
    
    it 'should match when method matches and args match' do
      @e.with(7).matches?(:foo, 7).should == true
    end
    
    it 'should not match when method matches but args do not match' do
      @e.with(7).matches?(:foo, 8).should == false
    end
  
    it 'should not yield by default' do
      @e.yield_container.should == nil
    end
  
    it 'should store yield value' do
      @e.yield(1).yield_container.should == Container.new([1])
    end

    it 'should store multiple yield values' do
      @e.yield(1,2).yield_container.should == Container.new([1,2])
    end
    
    it 'should not return by default' do
      @e.return_container.should == nil
    end
    
    it 'should store return value' do
      @e.return(1).return_container.should == Container.new([1])
    end

    it 'should store multiple return values' do
      @e.return(1,2).return_container.should == Container.new([1,2])
    end
    
    it 'should not raise by default' do
      @e.raiser.should == nil
    end
    
    it 'should store raiser' do
      @e.raise('description').raiser.should.not == nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
orangutan-0.0.3 spec/spec_expectation.rb