Module: Turnip::RSpec

Defined in:
lib/turnip_formatter/ext/turnip/rspec.rb

Defined Under Namespace

Modules: Execute

Class Method Summary collapse

Class Method Details

.run(feature_file) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/turnip_formatter/ext/turnip/rspec.rb', line 40

def run(feature_file)
  Turnip::Builder.build(feature_file).features.each do |feature|
    describe feature.name, feature. do
      before do
        example.[:file_path] = feature_file
        

        feature.backgrounds.each do |background|
          (background)
        end

        feature.backgrounds.map(&:steps).flatten.each.with_index do |step, index|
          run_step(feature_file, step, index)
        end
      end
      feature.scenarios.each do |scenario|
        describe scenario.name, scenario. do
          before do
            (scenario)
          end

          it scenario.steps.map(&:description).join(' -> ') do
            scenario.steps.each.with_index do |step, index|
              run_step(feature_file, step, index)
            end
          end
        end
      end
    end
  end
end