Module: AllureRSpec::DSL::Example

Defined in:
lib/allure-rspec/dsl.rb

Instance Method Summary collapse

Instance Method Details

#attach_file(title, file, opts = {}) ⇒ Object



29
30
31
32
33
34
# File 'lib/allure-rspec/dsl.rb', line 29

def attach_file(title, file, opts = {})
  suite = __description([:example_group])
  test = __description()
  step = current_step
  AllureRubyAdaptorApi::Builder.add_attachment suite, test, opts.merge(:title => title, :file => file, :step => step)
end

#current_stepObject



7
8
9
10
11
12
13
# File 'lib/allure-rspec/dsl.rb', line 7

def current_step
  if defined? @@__current_step
    @@__current_step
  else
    nil
  end
end

#step(step, &block) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/allure-rspec/dsl.rb', line 15

def step(step, &block)
  suite = __description([:example_group])
  test = __description()
  begin
    AllureRubyAdaptorApi::Builder.start_step(suite, test, step)
    __with_step step, &block
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step)
  rescue Exception => e
    AllureRubyAdaptorApi::Builder.stop_step(suite, test, step, :failed)
    raise e
  end
end