Module: Assay::Matchers

Defined in:
lib/assay/assertions/nil_failure.rb,
lib/assay/assertions/kind_failure.rb,
lib/assay/assertions/same_failure.rb,
lib/assay/assertions/true_failure.rb,
lib/assay/assertions/delta_failure.rb,
lib/assay/assertions/empty_failure.rb,
lib/assay/assertions/false_failure.rb,
lib/assay/assertions/match_failure.rb,
lib/assay/assertions/raise_failure.rb,
lib/assay/assertions/throw_failure.rb,
lib/assay/assertions/compare_failure.rb,
lib/assay/assertions/equality_failure.rb,
lib/assay/assertions/identity_failure.rb,
lib/assay/assertions/instance_failure.rb,
lib/assay/assertions/response_failure.rb,
lib/assay/assertions/execution_failure.rb

Instance Method Summary collapse

Instance Method Details

#be_emptyObject

Empty?

object.should be_empty


70
71
72
# File 'lib/assay/assertions/empty_failure.rb', line 70

def be_empty
  EmptyFailure.to_matcher
end

#be_equal_to(exp) ⇒ Object

Passes if expected == actual.

'MY STRING'.should be_equal_to('my string'.upcase)
'MY STRING'.should_not be_equal_to('another string')


91
92
93
# File 'lib/assay/assertions/equality_failure.rb', line 91

def be_equal_to(exp)
  EqualityFailure.to_matcher(exp)
end

#be_extecuted(&block) ⇒ Object

proc.should be_executed(*args)



86
87
88
# File 'lib/assay/assertions/execution_failure.rb', line 86

def be_extecuted(&block)
  ExecutionFailure.to_matcher(&block)
end

#be_falseObject

value.should be_false



68
69
70
# File 'lib/assay/assertions/false_failure.rb', line 68

def be_false
  FalseFailure.to_matcher
end

#be_identical_to(obj) ⇒ Object

object1.should be_identical_to(object2)



80
81
82
# File 'lib/assay/assertions/identity_failure.rb', line 80

def be_identical_to(obj)
  IdentityFailure.to_matcher(obj)
end

#be_instance_of(cls) ⇒ Object

object.should be_instance_of(class)



72
73
74
# File 'lib/assay/assertions/instance_failure.rb', line 72

def be_instance_of(cls)
  InstanceFailure.to_matcher(cls)
end

#be_kind_of(cls) ⇒ Object

object.should be_a_kind_of(class)



75
76
77
# File 'lib/assay/assertions/kind_failure.rb', line 75

def be_kind_of(cls)
  KindFailure.to_matcher(cls)
end

#be_like(act) ⇒ Object

object1.should be_like(object2)



46
47
48
# File 'lib/assay/assertions/compare_failure.rb', line 46

def be_like(act)
  CompareFailure.to_matcher(act)
end

#be_match_for(regexp) ⇒ Object

object.should be_a_match_for(regexp)



81
82
83
# File 'lib/assay/assertions/match_failure.rb', line 81

def be_match_for(regexp)
  MatchFailure.to_matcher(regexp)
end

#be_nilObject

value.should be_nil



69
70
71
# File 'lib/assay/assertions/nil_failure.rb', line 69

def be_nil
  NilFailure.to_matcher
end

#be_raised(&blk) ⇒ Object

Exception.should be_raised{ … }



128
129
130
# File 'lib/assay/assertions/raise_failure.rb', line 128

def be_raised(&blk)
  RaiseFailure.to_matcher(&blk)
end

#be_responsive_to(method) ⇒ Object

object.should be_responsive_to(:method_symbol)



81
82
83
# File 'lib/assay/assertions/response_failure.rb', line 81

def be_responsive_to(method)
  ResponseFailure.to_matcher(method)
end

#be_same_as(obj) ⇒ Object

object1.should be_same_as(object2)



78
79
80
# File 'lib/assay/assertions/same_failure.rb', line 78

def be_same_as(obj)
  SameFailure.to_matcher(obj)
end

#be_thrown(&blk) ⇒ Object

:symbol.should be_thrown{ … }



117
118
119
# File 'lib/assay/assertions/throw_failure.rb', line 117

def be_thrown(&blk)
  ThrowFailure.to_matcher(&blk)
end

#be_trueObject

True?

value.should be_true


74
75
76
# File 'lib/assay/assertions/true_failure.rb', line 74

def be_true
  TrueFailure.to_matcher
end

#be_within(delta, act) ⇒ Object

value1.assert is_within(delta, value2)



75
76
77
# File 'lib/assay/assertions/delta_failure.rb', line 75

def be_within(delta, act)
  DeltaFailure.to_matcher(act, delta)
end

#is_emptyObject

Empty?

object.assert is_true


62
63
64
# File 'lib/assay/assertions/empty_failure.rb', line 62

def is_empty
  EmptyFailure.to_matcher
end

#is_equal_to(exp, opts = {}) ⇒ Object

Passes if expected == actual.

'MY STRING'.assert is_equal_to('my string'.upcase)
'MY STRING'.refute is_equal_to('another string')


82
83
84
# File 'lib/assay/assertions/equality_failure.rb', line 82

def is_equal_to(exp, opts={})
  EqualityFailure.to_matcher(exp)
end

#is_executed(&block) ⇒ Object

TODO: Reasonable matcher for ExectuionFailure ?

proc.assert is_executed(*args)


78
79
80
# File 'lib/assay/assertions/execution_failure.rb', line 78

def is_executed(&block)
  ExecutionFailure.to_matcher(&block)
end

#is_falseObject

value.assert is_false



60
61
62
# File 'lib/assay/assertions/false_failure.rb', line 60

def is_false
  FalseFailure.to_matcher
end

#is_identical_to(obj) ⇒ Object

object1.assert is_identical_to(object2)



72
73
74
# File 'lib/assay/assertions/identity_failure.rb', line 72

def is_identical_to(obj)
  IdentityFailure.to_matcher(obj)
end

#is_instance_of(cls) ⇒ Object

object.assert is_instance_of(class)



64
65
66
# File 'lib/assay/assertions/instance_failure.rb', line 64

def is_instance_of(cls)
  InstanceFailure.to_matcher(cls)
end

#is_kind_of(cls) ⇒ Object

object.assert is_a_kind_of(class)



67
68
69
# File 'lib/assay/assertions/kind_failure.rb', line 67

def is_kind_of(cls)
  KindFailure.to_matcher(cls) 
end

#is_like(act) ⇒ Object

object1.should be_like(object2)



54
55
56
# File 'lib/assay/assertions/compare_failure.rb', line 54

def is_like(act)
  CompareFailure.to_matcher(act)
end

#is_match_for(regexp) ⇒ Object

object.assert is_a_match_for(regexp)



73
74
75
# File 'lib/assay/assertions/match_failure.rb', line 73

def is_match_for(regexp)
  MatchFailure.to_matcher(regexp)
end

#is_nilObject

value.assert is_nil



61
62
63
# File 'lib/assay/assertions/nil_failure.rb', line 61

def is_nil
  NilFailure.to_matcher
end

#is_raised(&blk) ⇒ Object

Exception.assert is_raised{ … }



120
121
122
# File 'lib/assay/assertions/raise_failure.rb', line 120

def is_raised(&blk)
  RaiseFailure.to_matcher(&blk)
end

#is_responsive_to(method) ⇒ Object

object.assert is_responsive_to(:method_symbol)



73
74
75
# File 'lib/assay/assertions/response_failure.rb', line 73

def is_responsive_to(method)
  ResponseFailure.to_matcher(method)
end

#is_same_as(obj) ⇒ Object

object1.assert is_same_as(object2)



70
71
72
# File 'lib/assay/assertions/same_failure.rb', line 70

def is_same_as(obj)
  SameFailure.to_matcher(obj)
end

#is_thrown(&blk) ⇒ Object

:symbol.assert is_thrown{ … }



109
110
111
# File 'lib/assay/assertions/throw_failure.rb', line 109

def is_thrown(&blk)
  ThrowFailure.to_matcher(&blk)
end

#is_trueObject

True?

value.assert is_true


66
67
68
# File 'lib/assay/assertions/true_failure.rb', line 66

def is_true
  TrueFailure.to_matcher
end

#is_within(delta, act) ⇒ Object

value1.should be_within(delta, value2)



67
68
69
# File 'lib/assay/assertions/delta_failure.rb', line 67

def is_within(delta, act)
  DeltaFailure.to_matcher(act, delta)
end