Module: Crspec::Matchers

Included in:
Expectations
Defined in:
lib/crspec/matchers.rb

Defined Under Namespace

Classes: BaseMatcher, BeFalsyMatcher, BeMatcher, BeNilMatcher, BeTruthyMatcher, EqMatcher, IncludeMatcher, RaiseErrorMatcher, RespondToMatcher

Instance Method Summary collapse

Instance Method Details

#be(expected = nil) ⇒ Object



175
176
177
# File 'lib/crspec/matchers.rb', line 175

def be(expected = nil)
  BeMatcher.new(expected)
end

#be_falsyObject



187
188
189
# File 'lib/crspec/matchers.rb', line 187

def be_falsy
  BeFalsyMatcher.new
end

#be_nilObject



179
180
181
# File 'lib/crspec/matchers.rb', line 179

def be_nil
  BeNilMatcher.new
end

#be_truthyObject



183
184
185
# File 'lib/crspec/matchers.rb', line 183

def be_truthy
  BeTruthyMatcher.new
end

#eq(expected) ⇒ Object



171
172
173
# File 'lib/crspec/matchers.rb', line 171

def eq(expected)
  EqMatcher.new(expected)
end

#include(*expected) ⇒ Object



191
192
193
# File 'lib/crspec/matchers.rb', line 191

def include(*expected)
  IncludeMatcher.new(expected.size == 1 ? expected.first : expected)
end

#raise_error(expected_exception = StandardError, message = nil) ⇒ Object



195
196
197
# File 'lib/crspec/matchers.rb', line 195

def raise_error(expected_exception = StandardError, message = nil)
  RaiseErrorMatcher.new(expected_exception, message)
end

#respond_to(*methods) ⇒ Object



199
200
201
# File 'lib/crspec/matchers.rb', line 199

def respond_to(*methods)
  RespondToMatcher.new(*methods)
end