Sha256: f47621c640de869bb9924fa3a308a6aee52d4056d4f42e7ecfc37932ef68025d

Contents?: true

Size: 1011 Bytes

Versions: 9

Compression:

Stored size: 1011 Bytes

Contents

require 'teststrap'

context "basic assertion" do
  setup { Riot::Situation.new }

  should "have a description" do
    Riot::Assertion.new("i will pass", topic).to_s
  end.equals("i will pass")

  asserts "pass? is true when assertion passed" do
    Riot::Assertion.new("i will pass", topic) { true }.passed?
  end

  asserts "failure? is true when assertion does not pass" do
    Riot::Assertion.new("i will pass", topic) { false }.failed?
  end

  asserts "error? is true when an unexpected Exception is raised" do
    Riot::Assertion.new("error", topic) { raise Exception, "blah" }.errored?
  end

  context "that fails while executing a test" do
    setup do
      fake_situation = Riot::Situation.new
      Riot::Assertion.new("error", fake_situation) { fail("I'm a bum") }
    end

    should("be considered a failing assertion") { topic.failed? }
    should("use failed message in description") { topic.result.message }.matches(/I'm a bum/)
  end # that fails while executing test
end # basic assertion

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
riot-0.9.12 test/assertion_test.rb
riot-0.9.11 test/assertion_test.rb
riot-0.9.10 test/assertion_test.rb
riot-0.9.9 test/assertion_test.rb
riot-0.9.8 test/assertion_test.rb
riot-0.9.7 test/assertion_test.rb
riot-0.9.6 test/assertion_test.rb
riot-0.9.5 test/assertion_test.rb
riot-0.9.4 test/assertion_test.rb