~ubuntu-branches/ubuntu/wily/cucumber/wily-proposed

« back to all changes in this revision

Viewing changes to spec/cucumber/ast/feature_factory.rb

  • Committer: Package Import Robot
  • Author(s): Cédric Boutillier, Antonio Terceiro, Cédric Boutillier
  • Date: 2015-06-20 16:52:32 UTC
  • mfrom: (1.1.7)
  • Revision ID: package-import@ubuntu.com-20150620165232-hznc8mxma08er27p
Tags: 2.0.0-1
[ Antonio Terceiro ]
* debian/cucumber.pod: fix typo in manpage (Closes: #767215)

[ Cédric Boutillier ]
* Imported Upstream version 2.0.0
* rename the file in debian/missing-source to remove -min suffix, and make
  lintian happy
* reproducibility: use last changelog date to build the manpage
* update 0004-Update_default_binary_path.patch
* drop 0001-Remove-rubygems-bundler-stuff-from-spec_helper.patch, not needed
  anymore
* build-depend on pry
* depend on ruby-cucumber-core

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
require 'cucumber/ast'
2
 
require 'cucumber/step_mother'
3
 
require 'gherkin/formatter/model'
4
 
 
5
 
module Cucumber
6
 
  module Ast
7
 
    module FeatureFactory
8
 
      class MyWorld
9
 
        def flunk
10
 
          raise "I flunked"
11
 
        end
12
 
      end
13
 
 
14
 
      def create_feature(dsl)
15
 
        dsl.Given /^a (.*) step with an inline arg:$/ do |what, table|
16
 
        end
17
 
        dsl.Given /^a (.*) step$/ do |what|
18
 
          flunk if what == 'failing'
19
 
        end
20
 
        dsl.World do
21
 
          MyWorld.new
22
 
        end
23
 
 
24
 
        table = Ast::Table.new([
25
 
          %w{1 22 333},
26
 
          %w{4444 55555 666666}
27
 
        ])
28
 
        doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n}, '')
29
 
        location = Ast::Location.new('foo.feature', 2)
30
 
        language = double.as_null_object
31
 
 
32
 
        background = Ast::Background.new(
33
 
          language,
34
 
          location,
35
 
          Ast::Comment.new(""), 
36
 
          "Background:", 
37
 
          "", 
38
 
          "",
39
 
          [
40
 
            Step.new(language, location.on_line(3), "Given", "a passing step")
41
 
          ]
42
 
        )
43
 
 
44
 
        location = Location.new('features/pretty_printing.feature', 0)
45
 
 
46
 
        Ast::Feature.new(
47
 
          location,
48
 
          background,
49
 
          Ast::Comment.new("# My feature comment\n"),
50
 
          Ast::Tags.new(6, [Gherkin::Formatter::Model::Tag.new('one', 6), Gherkin::Formatter::Model::Tag.new('two', 6)]),
51
 
          "Feature",
52
 
          "Pretty printing",
53
 
          "",
54
 
          [Ast::Scenario.new(
55
 
            language,
56
 
            location.on_line(9),
57
 
            background,
58
 
            Ast::Comment.new("    # My scenario comment  \n# On two lines \n"),
59
 
            Ast::Tags.new(8, [Gherkin::Formatter::Model::Tag.new('three', 8), Gherkin::Formatter::Model::Tag.new('four', 8)]),
60
 
            Ast::Tags.new(1, []),
61
 
            "Scenario:", "A Scenario", "",
62
 
            [
63
 
              Step.new(language, location.on_line(10), "Given", "a passing step with an inline arg:", table),
64
 
              Step.new(language, location.on_line(11), "Given", "a happy step with an inline arg:", doc_string),
65
 
              Step.new(language, location.on_line(12), "Given", "a failing step")
66
 
            ]
67
 
          )]
68
 
        )
69
 
      end
70
 
    end
71
 
  end
72
 
end