Module: RSpec::Parameterized::TableSyntaxImplement

Extended by:
BindingNinja
Defined in:
lib/rspec/parameterized/table_syntax.rb

Instance Method Summary collapse

Instance Method Details

#|(where_binding, other) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rspec/parameterized/table_syntax.rb', line 9

def |(where_binding, other)
  caller_instance = where_binding.receiver # get caller instance (ExampleGroup)

  if caller_instance.instance_variable_defined?(:@__parameter_table)
    table = caller_instance.instance_variable_get(:@__parameter_table)
  else
    table = RSpec::Parameterized::Table.new
    caller_instance.instance_variable_set(:@__parameter_table, table)
  end

  row = Table::Row.new(self)
  table.add_row(row)
  row.add_param(other)
  table
end