Sha256: 44e3e746bdbbdb8e99b014ffe87c25a4d7ef627ba8c773f354075c390e343362

Contents?: true

Size: 1.83 KB

Versions: 24

Compression:

Stored size: 1.83 KB

Contents

require 'cucumber/ast'
require 'cucumber/step_mother'
require 'gherkin/formatter/model'

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

        table = Ast::Table.new([
          %w{1 22 333},
          %w{4444 55555 666666}
        ])
        doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n}, '')
        
        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, [Gherkin::Formatter::Model::Tag.new('one', 6), Gherkin::Formatter::Model::Tag.new('two', 6)]),
          "Feature",
          "Pretty printing",
          "",
          [Ast::Scenario.new(
            background,
            Ast::Comment.new("    # My scenario comment  \n# On two lines \n"),
            Ast::Tags.new(8, [Gherkin::Formatter::Model::Tag.new('three', 8), Gherkin::Formatter::Model::Tag.new('four', 8)]),
            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:", doc_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

24 entries across 22 versions & 8 rubygems

Version Path
candlepin-api-0.4.0 bundle/ruby/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
casecumber-1.2.1.cb2 spec/cucumber/ast/feature_factory.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/cucumber-1.2.1/spec/cucumber/ast/feature_factory.rb
cucumber-1.2.1 spec/cucumber/ast/feature_factory.rb
resque-pool-0.3.0 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
ftl-0.2.0 vendor/bundle/gems/cucumber-1.2.0/spec/cucumber/ast/feature_factory.rb
cucumber-1.2.0 spec/cucumber/ast/feature_factory.rb
frameworks-capybara-0.2.0.rc6 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
frameworks-capybara-0.2.0.rc5 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
frameworks-capybara-0.2.0.rc4 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
frameworks-capybara-0.2.0.rc3 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
frameworks-capybara-0.2.0.rc2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
resque-pool-0.3.0.beta.2 vendor/bundle/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
radiant-1.0.0 ruby-debug/ruby/1.8/gems/cucumber-1.1.9/spec/cucumber/ast/feature_factory.rb
cucumber-1.1.9 spec/cucumber/ast/feature_factory.rb