Sha256: 2c3cd89835b8799a5219224b82ab66c4a384a2a5357aa1fd52619cd83d600027

Contents?: true

Size: 703 Bytes

Versions: 5

Compression:

Stored size: 703 Bytes

Contents

describe "demand :symbols!" do
  
  before {
    @fail = Checked::Demand::Failed
    @d = lambda { |val|
      d=Checked::Demand.new(val)
      d << :symbols!
      d.target
    }
  }

  it 'must require Array' do
    m = should.raise(NoMethodError) {
      @d.call :sym
    }.message
    m.should.include "Symbol, :sym, can not demand symbols!, which is found in"
    m.should.include "in: Arrays"
  end

  it 'must require Array be non-empty.' do
    should.raise(@fail) {
      @d.call( [] )
    }.message.should.be == "Array, [], can't be empty."
  end
  
  it 'must pass for Array of single Symbol instance' do
    @d.call([:sym]).should.be == [:sym]
  end
  
end # === describe Demand for Arrays

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
Checked-0.1.4 spec/tests/Demand_Arrays.rb
Checked-0.1.3 spec/tests/Demand_Arrays.rb
Checked-0.1.2 spec/tests/Demand_Arrays.rb
Checked-0.1.1 spec/tests/Demand_Arrays.rb
Checked-0.1.0 spec/tests/Demand_Arrays.rb