Sha256: 026ef6065e2670f3588b676a728d6fbfd3618a09c2716f42762f395446ec7265

Contents?: true

Size: 1.71 KB

Versions: 84

Compression:

Stored size: 1.71 KB

Contents

require 'cucumber/ast'
require 'cucumber/step_mother'

module Cucumber
  module Ast
    module FeatureFactory
      class MyWorld
        def flunk
          raise "I flunked"
        end
      end
      
      def create_feature(step_mother)
        step_mother.extend(StepMother)
        step_mother.Given /^a (.*) step with an inline arg:$/ do |what, table|
        end
        step_mother.Given /^a (.*) step$/ do |what|
          flunk if what == 'failing'
        end
        step_mother.World do
          MyWorld.new
        end

        table = Ast::Table.new([
          %w{1 22 333},
          %w{4444 55555 666666}
        ])
        py_string = Ast::PyString.new(21, 22, %{
           I like
          Cucumber sandwich
        }, 10)
        
        background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
          [
            Step.new(3, "Given", "a passing step")
          ]
        )
        
        f = Ast::Feature.new(
          background,
          Ast::Comment.new("# My feature comment\n"),
          Ast::Tags.new(6, ['one', 'two']),
          "Pretty printing",
          [Ast::Scenario.new(
            background,
            Ast::Comment.new("    # My scenario comment  \n# On two lines \n"),
            Ast::Tags.new(8, ['three', 'four']),
            9,
            "Scenario:", "A Scenario",
            [
              Step.new(10, "Given", "a passing step with an inline arg:", table),
              Step.new(11, "Given", "a happy step with an inline arg:", py_string),
              Step.new(12, "Given", "a failing step")
            ]
          )]
        )
        f.file = 'features/pretty_printing.feature'
        f.features = Features.new
        f
      end
    end
  end
end

Version data entries

84 entries across 84 versions & 9 rubygems

Version Path
aslakhellesoy-cucumber-0.2.3.1 specs/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.2.3.2 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.2.3.3 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.2.3.4 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.0.1 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.0 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.1.1 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.1 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.10 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11.1 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11.200907091518 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11.3 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11.5 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11.6 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.11 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.2 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.3.1 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.3.2 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.3.3 spec/cucumber/ast/feature_factory.rb
aslakhellesoy-cucumber-0.3.3.4 spec/cucumber/ast/feature_factory.rb