Class: RSpecOutlines::Outline

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(example_group, &definition) ⇒ Outline

Returns a new instance of Outline.



91
92
93
94
95
# File 'lib/rspec_outlines.rb', line 91

def initialize(example_group, &definition)
  @example_group = example_group
  @definition = definition
  @fields = nil
end

Instance Attribute Details

#definitionObject (readonly)

Returns the value of attribute definition.



97
98
99
# File 'lib/rspec_outlines.rb', line 97

def definition
  @definition
end

#example_groupObject (readonly)

Returns the value of attribute example_group.



97
98
99
# File 'lib/rspec_outlines.rb', line 97

def example_group
  @example_group
end

#fieldsObject

Returns the value of attribute fields.



97
98
99
# File 'lib/rspec_outlines.rb', line 97

def fields
  @fields
end

Instance Method Details

#eval(*values) ⇒ Object



103
104
105
106
107
108
# File 'lib/rspec_outlines.rb', line 103

def eval(*values)
  fields or
    raise Error, "no fields defined"
  outline_binding = OutlineBinding.new(fields, values)
  example_group.instance_eval_with_outline_binding(outline_binding, &definition)
end