Sha256: 849814d142845f24778ebe5f49a539cb8ddfc4e81030655ca8494db11f5ee942

Contents?: true

Size: 883 Bytes

Versions: 2

Compression:

Stored size: 883 Bytes

Contents

require 'pork/test'

describe 'meta' do
  before do
    @stat = Pork::Stat.new(Pork.report_class.new(StringIO.new))
    @suite = Class.new(Pork::Suite){init}
  end

  def execute
    Pork::Executor.execute(:suite => @suite, :stat => @stat)
  end

  would 'raise missing assertion' do
    @suite.would{}
    @suite.after{ok} # defined after would so no run for that
    stat = execute
    err, _, _ = stat.exceptions.first

    expect(err).kind_of?(Pork::Error)
    expect(err.message).eq 'Missing assertions'
  end

  would 'not raise missing assertion if there is one in after block' do
    @suite.after{ok}
    @suite.would{}
    stat = execute

    expect(stat.exceptions).empty?
  end

  would 'run after block even if there is an error in test' do
    called = false
    @suite.after{ called = true }
    @suite.would{ flunk }
    execute

    expect(called).eq true
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pork-2.1.0 test/test_meta.rb
pork-2.0.0 test/test_meta.rb