Sha256: cd11a6c3d91d1344853bf6373e8653e6a27c8d0f943bd5d9eb71b75d30cc1a48

Contents?: true

Size: 1006 Bytes

Versions: 1

Compression:

Stored size: 1006 Bytes

Contents

require 'assert'

class Assert::Assertions::AssertBlockTest < Assert::Context
  desc "the assert_block helper run in a test"
  setup do
    fail_desc = @fail_desc = "assert block fail desc"
    @test = Factory.test do
      assert_block{ true }
      assert_block(fail_desc){ false }
    end
    @test.run
  end
  subject{ @test }

  should "have 2 total results" do
    assert_equal 2, subject.result_count
  end
  should "have 1 pass result" do
    assert_equal 1, subject.result_count(:pass)
  end
  should "have 1 fail result" do
    assert_equal 1, subject.result_count(:fail)
  end

  class FailMessageTest < AssertBlockTest
    desc "with a failed result"
    setup do
      @expected = [ "Expected block to return true value.", @fail_desc ].join("\n")
      @fail_message = @test.fail_results.first.message
    end
    subject{ @fail_message }

    should "have a fail message with an explanation of what failed and my fail description" do
      assert_equal @expected, subject
    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
assert-0.1.0 test/assertions/assert_block_test.rb