Class: Assert::Macro

Inherits:
Proc
  • Object
show all
Defined in:
lib/assert/macro.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, *args, &block) ⇒ Macro

Returns a new instance of Macro.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/assert/macro.rb', line 10

def initialize(name=nil, *args, &block)
  raise ArgumentError unless block_given?
  @name = name || "run this macro"
  super()
end

Instance Attribute Details

#nameObject

this class is essentially a way to define a custom set of tests using arguments. When passed as an argument to the ‘should’ method, a macro will be instance_eval’d in that Assert::Context.



8
9
10
# File 'lib/assert/macro.rb', line 8

def name
  @name
end