Module: MotionSpec::ContextHelper::Matchers
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 76
def method_missing(method_name, *args, &block)
string_method_name = method_name.to_s
match_be = string_method_name.match(/^be_(.*)/)
if match_be
return MotionSpec::Matcher::BeGeneric.new(match_be[1], *args)
end
match_have = string_method_name.match(/^have_(.*)/)
if match_have
return MotionSpec::Matcher::HaveGeneric.new(match_have[1], *args)
end
super
end
|
Instance Method Details
#be(value) ⇒ Object
Also known as:
equal
26
27
28
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 26
def be(value)
MotionSpec::Matcher::Be.new(value)
end
|
5
6
7
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 5
def be_nil
MotionSpec::Matcher::BeNil.new
end
|
9
10
11
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 9
def be_true
MotionSpec::Matcher::BeTrue.new
end
|
#change(&change_block) ⇒ Object
68
69
70
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 68
def change(&change_block)
MotionSpec::Matcher::Change.new(change_block)
end
|
#end_with(substring) ⇒ Object
64
65
66
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 64
def end_with(substring)
MotionSpec::Matcher::EndWith.new(substring)
end
|
#eq(value) ⇒ Object
31
32
33
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 31
def eq(value)
MotionSpec::Matcher::Eq.new(value)
end
|
#eql(value) ⇒ Object
22
23
24
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 22
def eql(value)
MotionSpec::Matcher::Eql.new(value)
end
|
#match_array(array) ⇒ Object
Also known as:
contain_exactly
#raise_error(exception_class = Exception, message = '') ⇒ Object
Also known as:
raise_exception
17
18
19
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 17
def raise_error(exception_class = Exception, message = '')
MotionSpec::Matcher::RaiseError.new(exception_class, message)
end
|
#respond_to(method_name) ⇒ Object
56
57
58
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 56
def respond_to(method_name)
MotionSpec::Matcher::RespondTo.new(method_name)
end
|
#start_with(substring) ⇒ Object
60
61
62
|
# File 'lib/motion-spec/context_helper/matchers.rb', line 60
def start_with(substring)
MotionSpec::Matcher::StartWith.new(substring)
end
|