Class: Test::Spec::CustomShould

Inherits:
Object
  • Object
show all
Defined in:
lib/test/spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(obj) ⇒ CustomShould

Returns a new instance of CustomShould.


308
309
310
# File 'lib/test/spec.rb', line 308

def initialize(obj)
  self.object = obj
end

Instance Attribute Details

#objectObject

Returns the value of attribute object


306
307
308
# File 'lib/test/spec.rb', line 306

def object
  @object
end

Instance Method Details

#assumptions(*args, &block) ⇒ Object

Raises:

  • (NotImplementedError)

321
322
323
# File 'lib/test/spec.rb', line 321

def assumptions(*args, &block)
  raise NotImplementedError, "you need to supply a #{self.class}#matches? method"
end

#failure_messageObject


312
313
314
# File 'lib/test/spec.rb', line 312

def failure_message
  "#{self.class.name} failed"
end

#matches?(*args, &block) ⇒ Boolean

Returns:

  • (Boolean)

316
317
318
319
# File 'lib/test/spec.rb', line 316

def matches?(*args, &block)
  assumptions(*args, &block)
  true
end