Class: Matest::ExampleBeforeAssertion

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

Instance Attribute Summary

Attributes inherited from Example

#code

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.



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

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

Instance Method Details

#before_assertion_blockObject



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

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

#set_stateObject



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

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