Class: TurnipHelper

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/acceptance_test/turnip/turnip_helper.rb

Instance Method Summary collapse

Instance Method Details

#configure(title: 'Turnip', report_file:, steps_dir:) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/acceptance_test/turnip/turnip_helper.rb', line 8

def configure(title: 'Turnip', report_file:, steps_dir:)
  # configure turnip formatter

  require 'turnip_formatter'

  RSpec.configure do |config|
    config.add_formatter RSpecTurnipFormatter, report_file
  end

  TurnipFormatter.configure do |config|
    config.title = title
  end

  # configure gnawrnip

  require 'gnawrnip'

  Gnawrnip.configure do |c|
    c.make_animation = true
    c.max_frame_size = 1024 # pixel
  end

  Gnawrnip.ready!

  load_steps [steps_dir]
end

#load_steps(support_dirs) ⇒ Object



35
36
37
38
39
40
41
42
43
44
# File 'lib/acceptance_test/turnip/turnip_helper.rb', line 35

def load_steps support_dirs
  support_dirs.each do |support_dir|
    Dir["#{support_dir}/**/steps/*_steps.rb"].each do |name|
      ext = File.extname(name)
      name = name[support_dir.length+1..name.length-ext.length-1]

      require name
    end
  end
end