Method: Inspec::Expect#example_group

Defined in:
lib/inspec/expect.rb

#example_groupObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/inspec/expect.rb', line 25

def example_group
  that = self

  opts = { 'caller' => calls[0][3] }
  if !calls[0][3].nil? && !calls[0][3].empty? &&
     (m = calls[0][3][0].match(/^([^:]*):(\d+):/))
    opts['file_path'] = m[0]
    opts['line_number'] = m[1]
  end

  RSpec::Core::ExampleGroup.describe(that.value, opts) do
    that.calls.each do |method, args, block, clr|
      it(nil, caller: clr) do
        x = expect(that.value, &that.block).method(method)
        x.call(*args, &block)
      end
    end
  end
end