Sha256: a819a31560612fe4d2e01975d758dd5a004d5dd9f6f3b8e44f706f9b27454dfa

Contents?: true

Size: 1.18 KB

Versions: 9

Compression:

Stored size: 1.18 KB

Contents

require 'pork/auto'

describe 'A' do
  include Module.new{
    def m
      object_id
    end
  }

  def f
    object_id
  end

  would 'f' do
    f.should.eq m
    f.should.kind_of? Fixnum
    lambda{ f.should.eq '' }.should.raise Pork::Failure
  end

  copy do
    def t
      true
    end

    would do
      t.should.eq true
    end
  end

  paste

  describe 'B' do
    would 'have the same context' do
      f.should.eq m
      m.should.not.kind_of? String
      lambda{ throw :halt }.should.throw :halt
      lambda{ lambda{ throw :halt }.should.not.throw :halt }.
        should.raise Pork::Failure
    end

    paste

    would do
      t.should.eq true
    end

    describe 'C' do
      paste
    end
  end

  would 'skip' do
    skip
    should.flunk
  end
end

would 'also work on top-level' do
  true.should.eq true
end

describe 'should(message)' do
  would 'show message' do
    should.raise(Pork::Failure){ should('nnf').satisfy('qoo'){ false } }.
      message.should.eq "Expect qoo\nnnf"
  end

  would 'show lazy message' do
    should.raise(Pork::Failure) do
      should(nil, lambda{'nnf'}).satisfy(nil, lambda{'qoo'}){ false }
    end.message.should.eq "Expect qoo\nnnf"
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pork-1.1.3 test/test_nested.rb
pork-1.1.2 test/test_nested.rb
pork-1.1.1 test/test_nested.rb
pork-1.1.0 test/test_nested.rb
pork-1.0.4 test/test_nested.rb
pork-1.0.3 test/test_nested.rb
pork-1.0.2 test/test_nested.rb
pork-1.0.1 test/test_nested.rb
pork-1.0.0 test/test_nested.rb