Sha256: ea83c98cacdb5c4f3d7cd4565bf9e8189396925422a51f600feedff08c9c1855

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

= Matchers

  require 'assay'

  include Assay::Matchers

== EqualityFailure

  1.assert is_equal_to(1)

  expect Assay::EqualityFailure do
    1.assert is_equal_to(2)
  end

== TrueFailure

  true.assert is_true

  expect Assay::TrueFailure do
    false.assert is_true
  end

== FalseFailure

  false.assert is_false

  expect Assay::FalseFailure do
    true.assert is_false
  end

== NilFailure

  nil.assert is_nil

  expect Assay::NilFailure do
    true.assert is_nil
  end

== DeltaFailure

  1.assert is_within(1.5, 2)

  expect Assay::DeltaFailure do
    1.assert is_within(0.5, 2)
  end

== MatchFailure

  "abc".assert is_match_for(/a/)

  expect Assay::MatchFailure do
    "abc".assert is_match_for(/x/)
  end

== SameFailure

  1.assert is_same_as(1)

  expect Assay::SameFailure do
    1.assert is_same_as(1.0)
  end

== IdentityFailure

  :a.assert is_identical_to(:a)

  expect Assay::IdentityFailure do
    "a".assert is_identical_to("a")
  end

== InstanceFailure

  1.assert is_instance_of(Fixnum)

  expect Assay::InstanceFailure do
    1.assert is_instance_of(String)
  end

== KindFailure

  1.assert is_kind_of(Integer)

  expect Assay::KindFailure do
    1.assert is_kind_of(String)
  end

== RaiseFailure

  ArgumentError.assert is_raised{ raise ArgumentError }

  expect Assay::RaiseFailure do
    ArgumentError.assert is_raised{ raise TypeError }
  end

== ResponseFailure

  "string".assert is_responsive_to(:upcase)

  expect Assay::ResponseFailure do
    "string".assert is_responsive_to(:not_a_method)
  end

== ExecutionFailure

  assert is_executed{ :foo }

  expect Assay::ExecutionFailure do
    assert is_executed{ raise }
  end

== ThrowFailure

  :foo.assert is_thrown{ throw :foo }

  expect Assay::ThrowFailure do
    :foo.assert is_thrown{ throw :bar }
  end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
assay-0.3.0 qed/03_matchers.rdoc
assay-0.2.0 qed/03_matchers.rdoc