Class: Matest::ExampleBeforeAssertion

Inherits:
Example
  • Object
show all
Defined in:
lib/matest/example.rb

Instance Method Summary collapse

Methods inherited from Example

#call, #description, #example_block, #just_before_assertion, let, #lets, local_var, #track_lets, #track_variables

Constructor Details

#initialize(example_block, description, lets) ⇒ ExampleBeforeAssertion

Returns a new instance of ExampleBeforeAssertion.



76
77
78
79
# File 'lib/matest/example.rb', line 76

def initialize(example_block, description, lets)
  super
  set_state
end

Instance Method Details

#before_assertion_blockObject



87
88
89
# File 'lib/matest/example.rb', line 87

def before_assertion_block
  eval("proc { #{@code} }")
end

#set_stateObject



81
82
83
84
85
# File 'lib/matest/example.rb', line 81

def set_state
  before_sexp = example_block.sexp[0..-2]
  @code = Sorcerer.source(before_sexp)
  eval(@code)
end