Module: Crspec::Matchers

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

Defined Under Namespace

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

Instance Method Summary collapse

Instance Method Details

#be(expected = nil) ⇒ Object



226
227
228
# File 'lib/crspec/matchers.rb', line 226

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

#be_falsyObject



238
239
240
# File 'lib/crspec/matchers.rb', line 238

def be_falsy
  BeFalsyMatcher.new
end

#be_nilObject



230
231
232
# File 'lib/crspec/matchers.rb', line 230

def be_nil
  BeNilMatcher.new
end

#be_truthyObject



234
235
236
# File 'lib/crspec/matchers.rb', line 234

def be_truthy
  BeTruthyMatcher.new
end

#change(receiver = nil, message = nil, &block) ⇒ Object



254
255
256
# File 'lib/crspec/matchers.rb', line 254

def change(receiver = nil, message = nil, &block)
  ChangeMatcher.new(receiver, message, &block)
end

#eq(expected) ⇒ Object



222
223
224
# File 'lib/crspec/matchers.rb', line 222

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

#include(*expected) ⇒ Object



242
243
244
# File 'lib/crspec/matchers.rb', line 242

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

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



246
247
248
# File 'lib/crspec/matchers.rb', line 246

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

#respond_to(*methods) ⇒ Object



250
251
252
# File 'lib/crspec/matchers.rb', line 250

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