Sha256: 47f37d9973b8204e5a9e5d743e77c8651fa306eda6eb1b6950040a010c0a930b

Contents?: true

Size: 1.68 KB

Versions: 2

Compression:

Stored size: 1.68 KB

Contents

= Assertion Methods

  require 'assay'

  include Assay::Assertives

== EqualityFailure

  assert_equal(1,1)

  expect Assay::EqualityFailure do
    assert_equal(1,2)
  end

== TrueFailure

  assert_true(true)

  expect Assay::TrueFailure do
    assert_true(false)
  end

== FalseFailure

  assert_false(false)

  expect Assay::FalseFailure do
    assert_false(true)
  end

== NilFailure

  assert_nil(nil)

  expect Assay::NilFailure do
    assert_nil(true)
  end

== DeltaFailure

  assert_in_delta(1, 1.5, 2)

  expect Assay::DeltaFailure do
    assert_in_delta(1, 2.5, 1)
  end

== MatchFailure

  assert_match(/a/, "abc")

  expect Assay::MatchFailure do
    assert_match(/x/, "abc")
  end

== SameFailure

  assert_same(1, 1)

  expect Assay::SameFailure do
    assert_same(1, 1.0)
  end

== IdentityFailure

  assert_identical(:a, :a)

  expect Assay::IdentityFailure do
    assert_identical("a", "a")
  end

== InstanceFailure

  assert_instance_of(1, Fixnum)

  expect Assay::InstanceFailure do
    assert_instance_of(1, String)
  end

== KindFailure

  assert_kind_of(1, Integer)

  expect Assay::KindFailure do
    assert_kind_of(1, String)
  end

== RaiseFailure

  assert_raises(ArgumentError){ raise ArgumentError }

  expect Assay::RaiseFailure do
    assert_raises(ArgumentError){ raise TypeError }
  end

== ResponseFailure

  assert_responds_to("string", :upcase)

  expect Assay::ResponseFailure do
    assert_responds_to("string", :not_a_method)
  end

== Executionfailure

  assert_executes{ :ok }

  expect Assay::ExecutionFailure do
    assert_executes{ raise }
  end

== ThrowFailure

  assert_throws(:foo){ throw :foo }

  expect Assay::ThrowFailure do
    assert_throws(:foo){ throw :bar }
  end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assay-0.3.0 qed/02_assertives.rdoc
assay-0.2.0 qed/02_assertives.rdoc