cucumber-core 3.0.0.pre.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +4 -1
- data/{HISTORY.md → CHANGELOG.md} +38 -5
- data/CONTRIBUTING.md +2 -3
- data/README.md +2 -2
- data/lib/cucumber/core/ast/empty_multiline_argument.rb +0 -4
- data/lib/cucumber/core/ast/feature.rb +0 -10
- data/lib/cucumber/core/ast/outline_step.rb +9 -6
- data/lib/cucumber/core/ast/scenario.rb +0 -10
- data/lib/cucumber/core/ast/step.rb +11 -11
- data/lib/cucumber/core/compiler.rb +1 -1
- data/lib/cucumber/core/events.rb +4 -4
- data/lib/cucumber/core/gherkin/ast_builder.rb +6 -0
- data/lib/cucumber/core/report/summary.rb +1 -1
- data/lib/cucumber/core/test/filters/activate_steps_for_self_test.rb +1 -1
- data/lib/cucumber/core/test/result.rb +58 -9
- data/lib/cucumber/core/test/runner.rb +3 -3
- data/lib/cucumber/core/test/step.rb +6 -2
- data/lib/cucumber/core/version.rb +1 -1
- data/spec/cucumber/core/ast/outline_step_spec.rb +14 -8
- data/spec/cucumber/core/ast/step_spec.rb +12 -4
- data/spec/cucumber/core/compiler_spec.rb +19 -2
- data/spec/cucumber/core/filter_spec.rb +1 -1
- data/spec/cucumber/core/gherkin/parser_spec.rb +1 -1
- data/spec/cucumber/core/report/summary_spec.rb +4 -2
- data/spec/cucumber/core/test/case_spec.rb +1 -1
- data/spec/cucumber/core/test/filters/locations_filter_spec.rb +17 -9
- data/spec/cucumber/core/test/result_spec.rb +86 -13
- data/spec/cucumber/core/test/runner_spec.rb +6 -6
- data/spec/cucumber/core/test/step_spec.rb +10 -4
- data/spec/cucumber/core_spec.rb +12 -12
- metadata +7 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 15cf4b980313f359f353c814b64882a6e4813284
         | 
| 4 | 
            +
              data.tar.gz: e43878f811006e883fed0da63d468a8aad348963
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 32015aeac82148a7b00f2f32ae2df457cd63660f1cd8dcbcad8da9bda36dfb3cb8b20bd43312488c19ab3e18074940d90c9ad01826101843e8a1e810930768a1
         | 
| 7 | 
            +
              data.tar.gz: 8d57d02175e18afc9623bb981a997789561f4ce5a00492e31a9e2a2ad0436a3260210d1342924f7e0c51c2e8056b97f7d0e2d48df456eb8bf11b7dba87d919b7
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -9,9 +9,12 @@ matrix: | |
| 9 9 | 
             
                - rvm: 2.2
         | 
| 10 10 | 
             
                - rvm: 2.1
         | 
| 11 11 | 
             
                - rvm: 2.0.0
         | 
| 12 | 
            -
                - rvm: jruby-9.1. | 
| 12 | 
            +
                - rvm: jruby-9.1.13.0
         | 
| 13 13 | 
             
                  env:
         | 
| 14 14 | 
             
                    - JRUBY_OPTS="--debug"
         | 
| 15 | 
            +
                    - LC_ALL=en_US.UTF-8
         | 
| 16 | 
            +
                    - LANG=en_US.UTF-8
         | 
| 17 | 
            +
                    - LANGUAGE=en_US.UTF-8        
         | 
| 15 18 | 
             
              allow_failures:
         | 
| 16 19 | 
             
                - rvm: ruby-head
         | 
| 17 20 | 
             
              fast_finish: true
         | 
    
        data/{HISTORY.md → CHANGELOG.md}
    RENAMED
    
    | @@ -1,9 +1,42 @@ | |
| 1 | 
            -
             | 
| 1 | 
            +
            Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CONTRIBUTING.md) on how to contribute to Cucumber.
         | 
| 2 2 |  | 
| 3 | 
            -
             | 
| 4 | 
            -
             | 
| 5 | 
            -
            ###  | 
| 6 | 
            -
             | 
| 3 | 
            +
            ## [In Git](https://github.com/cucumber/cucumber-ruby-core/compare/v3.0.0...master) (targetting 3.1.0)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ### Changed
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * N/A
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### Added
         | 
| 10 | 
            +
             | 
| 11 | 
            +
            * N/A
         | 
| 12 | 
            +
             | 
| 13 | 
            +
            ### Fixed
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            * N/A
         | 
| 16 | 
            +
             | 
| 17 | 
            +
            ### Improved
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            * N/A
         | 
| 20 | 
            +
             | 
| 21 | 
            +
            ## [3.0.0](https://github.com/cucumber/cucumber-ruby-core/compare/v3.0.0.pre.2...v3.0.0) (2017-09-27)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            ### Changed
         | 
| 24 | 
            +
             | 
| 25 | 
            +
            * Step#name renamed to #text ([#137](https://github.com/cucumber/cucumber-ruby-core/pull/137) [@olleolleolle](https://github.com/olleolleolle))
         | 
| 26 | 
            +
            * Use past tense in event names (`xStarting` -> `xStarted`) (see [cucumber/cucumber-ruby#1166](https://github.com/cucumber/cucumber-ruby/issues/1166) @brasmusson).
         | 
| 27 | 
            +
             | 
| 28 | 
            +
            ### Added
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            * Do not create test cases for scenarios with no steps ([#144](https://github.com/cucumber/cucumber-ruby-core/pull/144) @brasmusson)
         | 
| 31 | 
            +
            * Handle selective strict settings ([#143](https://github.com/cucumber/cucumber-ruby-core/pull/143) @brasmusson)
         | 
| 32 | 
            +
             | 
| 33 | 
            +
            ### Fixed
         | 
| 34 | 
            +
             | 
| 35 | 
            +
            * Fix DataTable's Location to be aware of all of its lines ([#142](https://github.com/cucumber/cucumber-ruby-core/pull/142) @botandrose)
         | 
| 36 | 
            +
             | 
| 37 | 
            +
            ### Improved
         | 
| 38 | 
            +
             | 
| 39 | 
            +
            * As per [#251](https://github.com/cucumber/cucumber/issues/251): renamed History.md to CHANGELOG.md, added contributing message at beginning, and misc formatting. ([#145](https://github.com/cucumber/cucumber-ruby-core/pull/145) [jaysonesmith](https://github.com/jaysonesmith))
         | 
| 7 40 |  | 
| 8 41 | 
             
            ## [3.0.0.pre.2](https://github.com/cucumber/cucumber-ruby-core/compare/v2.0.0...3.0.0.pre.2) (2017-07-26)
         | 
| 9 42 |  | 
    
        data/CONTRIBUTING.md
    CHANGED
    
    | @@ -2,9 +2,8 @@ Release Process | |
| 2 2 | 
             
            ===============
         | 
| 3 3 |  | 
| 4 4 | 
             
            * Bump the version number in `lib/cucumber/core/version.rb`
         | 
| 5 | 
            -
            * Update ` | 
| 6 | 
            -
             | 
| 7 | 
            -
            * Now release it
         | 
| 5 | 
            +
            * Update `CHANGELOG.md` with the upcoming version number and create a new `In Git` section
         | 
| 6 | 
            +
            * Now release it:
         | 
| 8 7 |  | 
| 9 8 | 
             
            ```
         | 
| 10 9 | 
             
            bundle update
         | 
    
        data/README.md
    CHANGED
    
    | @@ -75,7 +75,7 @@ class ActivateSteps < Cucumber::Core::Filter.new | |
| 75 75 | 
             
              private
         | 
| 76 76 |  | 
| 77 77 | 
             
              def activate(step)
         | 
| 78 | 
            -
                case step. | 
| 78 | 
            +
                case step.text
         | 
| 79 79 | 
             
                when /fail/
         | 
| 80 80 | 
             
                  step.with_action { raise Failure }
         | 
| 81 81 | 
             
                when /pass/
         | 
| @@ -105,7 +105,7 @@ end | |
| 105 105 | 
             
            MyRunner.new.execute([feature], [ActivateSteps.new]) do |events|
         | 
| 106 106 | 
             
              events.on(:test_step_finished) do |event|
         | 
| 107 107 | 
             
                test_step, result = event.test_step, event.result
         | 
| 108 | 
            -
                puts "#{test_step. | 
| 108 | 
            +
                puts "#{test_step.text} #{result}"
         | 
| 109 109 | 
             
              end
         | 
| 110 110 | 
             
            end
         | 
| 111 111 | 
             
            ```
         | 
| @@ -42,16 +42,6 @@ module Cucumber | |
| 42 42 | 
             
                      end
         | 
| 43 43 | 
             
                    end
         | 
| 44 44 |  | 
| 45 | 
            -
                    def to_sexp
         | 
| 46 | 
            -
                      sexp = [:feature, file, name]
         | 
| 47 | 
            -
                      comment = @comment.to_sexp
         | 
| 48 | 
            -
                      sexp += [comment] if comment
         | 
| 49 | 
            -
                      tags = @tags.to_sexp
         | 
| 50 | 
            -
                      sexp += tags if tags.any?
         | 
| 51 | 
            -
                      sexp += @feature_elements.map{|fe| fe.to_sexp}
         | 
| 52 | 
            -
                      sexp
         | 
| 53 | 
            -
                    end
         | 
| 54 | 
            -
             | 
| 55 45 | 
             
                    private
         | 
| 56 46 |  | 
| 57 47 | 
             
                    def description_for_visitors
         | 
| @@ -11,19 +11,23 @@ module Cucumber | |
| 11 11 | 
             
                    include HasLocation
         | 
| 12 12 | 
             
                    include DescribesItself
         | 
| 13 13 |  | 
| 14 | 
            -
                    attr_reader :language, :location, :comments, :keyword, : | 
| 14 | 
            +
                    attr_reader :language, :location, :comments, :keyword, :text, :multiline_arg
         | 
| 15 15 |  | 
| 16 16 | 
             
                    def initialize(language, location, comments, keyword, text, multiline_arg)
         | 
| 17 | 
            -
                      @language, @location, @comments, @keyword, @ | 
| 17 | 
            +
                      @language, @location, @comments, @keyword, @text, @multiline_arg = language, location, comments, keyword, text, multiline_arg
         | 
| 18 18 | 
             
                    end
         | 
| 19 19 |  | 
| 20 20 | 
             
                    def to_step(row)
         | 
| 21 | 
            -
                      Ast::ExpandedOutlineStep.new(self, language, row.location, comments, keyword, row.expand( | 
| 21 | 
            +
                      Ast::ExpandedOutlineStep.new(self, language, row.location, comments, keyword, row.expand(text), replace_multiline_arg(row))
         | 
| 22 | 
            +
                    end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                    def to_s
         | 
| 25 | 
            +
                      text
         | 
| 22 26 | 
             
                    end
         | 
| 23 27 |  | 
| 24 28 | 
             
                    def inspect
         | 
| 25 | 
            -
                       | 
| 26 | 
            -
                      %{#<#{self.class} "#{ | 
| 29 | 
            +
                      keyword_and_text = [keyword, text].join(": ")
         | 
| 30 | 
            +
                      %{#<#{self.class} "#{keyword_and_text}" (#{location})>}
         | 
| 27 31 | 
             
                    end
         | 
| 28 32 |  | 
| 29 33 | 
             
                    private
         | 
| @@ -47,4 +51,3 @@ module Cucumber | |
| 47 51 | 
             
                end
         | 
| 48 52 | 
             
              end
         | 
| 49 53 | 
             
            end
         | 
| 50 | 
            -
             | 
| @@ -31,16 +31,6 @@ module Cucumber | |
| 31 31 | 
             
                      raw_steps
         | 
| 32 32 | 
             
                    end
         | 
| 33 33 |  | 
| 34 | 
            -
                    def to_sexp
         | 
| 35 | 
            -
                      sexp = [:scenario, line, keyword, name]
         | 
| 36 | 
            -
                      comment = comment.to_sexp
         | 
| 37 | 
            -
                      sexp += [comment] if comment
         | 
| 38 | 
            -
                      tags = tags.to_sexp
         | 
| 39 | 
            -
                      sexp += tags if tags.any?
         | 
| 40 | 
            -
                      sexp += step_invocations.to_sexp if step_invocations.any?
         | 
| 41 | 
            -
                      sexp
         | 
| 42 | 
            -
                    end
         | 
| 43 | 
            -
             | 
| 44 34 | 
             
                    private
         | 
| 45 35 |  | 
| 46 36 | 
             
                    def description_for_visitors
         | 
| @@ -9,18 +9,18 @@ module Cucumber | |
| 9 9 | 
             
                    include HasLocation
         | 
| 10 10 | 
             
                    include DescribesItself
         | 
| 11 11 |  | 
| 12 | 
            -
                    attr_reader :keyword, : | 
| 12 | 
            +
                    attr_reader :keyword, :text, :language, :comments, :exception, :multiline_arg
         | 
| 13 13 |  | 
| 14 | 
            -
                    def initialize(language, location, comments, keyword,  | 
| 15 | 
            -
                      @language, @location, @comments, @keyword, @ | 
| 14 | 
            +
                    def initialize(language, location, comments, keyword, text, multiline_arg)
         | 
| 15 | 
            +
                      @language, @location, @comments, @keyword, @text, @multiline_arg = language, location, comments, keyword, text, multiline_arg
         | 
| 16 16 | 
             
                    end
         | 
| 17 17 |  | 
| 18 | 
            -
                    def  | 
| 19 | 
            -
                       | 
| 18 | 
            +
                    def to_s
         | 
| 19 | 
            +
                      text
         | 
| 20 20 | 
             
                    end
         | 
| 21 21 |  | 
| 22 22 | 
             
                    def backtrace_line
         | 
| 23 | 
            -
                      "#{location}:in `#{keyword}#{ | 
| 23 | 
            +
                      "#{location}:in `#{keyword}#{text}'"
         | 
| 24 24 | 
             
                    end
         | 
| 25 25 |  | 
| 26 26 | 
             
                    def actual_keyword(previous_step_keyword = nil)
         | 
| @@ -36,8 +36,8 @@ module Cucumber | |
| 36 36 | 
             
                    end
         | 
| 37 37 |  | 
| 38 38 | 
             
                    def inspect
         | 
| 39 | 
            -
                       | 
| 40 | 
            -
                      %{#<#{self.class} "#{ | 
| 39 | 
            +
                      keyword_and_text = [keyword, text].join(": ")
         | 
| 40 | 
            +
                      %{#<#{self.class} "#{keyword_and_text}" (#{location})>}
         | 
| 41 41 | 
             
                    end
         | 
| 42 42 |  | 
| 43 43 | 
             
                    private
         | 
| @@ -53,8 +53,8 @@ module Cucumber | |
| 53 53 |  | 
| 54 54 | 
             
                  class ExpandedOutlineStep < Step
         | 
| 55 55 |  | 
| 56 | 
            -
                    def initialize(outline_step, language, location, comments, keyword,  | 
| 57 | 
            -
                      @outline_step, @language, @location, @comments, @keyword, @ | 
| 56 | 
            +
                    def initialize(outline_step, language, location, comments, keyword, text, multiline_arg)
         | 
| 57 | 
            +
                      @outline_step, @language, @location, @comments, @keyword, @text, @multiline_arg = outline_step, language, location, comments, keyword, text, multiline_arg
         | 
| 58 58 | 
             
                    end
         | 
| 59 59 |  | 
| 60 60 | 
             
                    def all_locations
         | 
| @@ -65,7 +65,7 @@ module Cucumber | |
| 65 65 |  | 
| 66 66 | 
             
                    def backtrace_line
         | 
| 67 67 | 
             
                      "#{step_backtrace_line}\n" +
         | 
| 68 | 
            -
                      "#{@outline_step.location}:in `#{@outline_step.keyword}#{@outline_step. | 
| 68 | 
            +
                      "#{@outline_step.location}:in `#{@outline_step.keyword}#{@outline_step.text}'"
         | 
| 69 69 | 
             
                    end
         | 
| 70 70 |  | 
| 71 71 | 
             
                  end
         | 
    
        data/lib/cucumber/core/events.rb
    CHANGED
    
    | @@ -5,7 +5,7 @@ module Cucumber | |
| 5 5 | 
             
                module Events
         | 
| 6 6 |  | 
| 7 7 | 
             
                  # Signals that a {Test::Case} is about to be executed
         | 
| 8 | 
            -
                  class  | 
| 8 | 
            +
                  class TestCaseStarted < Event.new(:test_case)
         | 
| 9 9 |  | 
| 10 10 | 
             
                    # @return [Test::Case] the test case to be executed
         | 
| 11 11 | 
             
                    attr_reader :test_case
         | 
| @@ -13,7 +13,7 @@ module Cucumber | |
| 13 13 | 
             
                  end
         | 
| 14 14 |  | 
| 15 15 | 
             
                  # Signals that a {Test::Step} is about to be executed
         | 
| 16 | 
            -
                  class  | 
| 16 | 
            +
                  class TestStepStarted < Event.new(:test_step)
         | 
| 17 17 |  | 
| 18 18 | 
             
                    # @return [Test::Step] the test step to be executed
         | 
| 19 19 | 
             
                    attr_reader :test_step
         | 
| @@ -47,8 +47,8 @@ module Cucumber | |
| 47 47 | 
             
                  # that will be used by the {EventBus} by default.
         | 
| 48 48 | 
             
                  def self.registry
         | 
| 49 49 | 
             
                    build_registry(
         | 
| 50 | 
            -
                       | 
| 51 | 
            -
                       | 
| 50 | 
            +
                      TestCaseStarted,
         | 
| 51 | 
            +
                      TestStepStarted,
         | 
| 52 52 | 
             
                      TestStepFinished,
         | 
| 53 53 | 
             
                      TestCaseFinished,
         | 
| 54 54 | 
             
                    )
         | 
| @@ -373,6 +373,12 @@ module Cucumber | |
| 373 373 | 
             
                      def rows
         | 
| 374 374 | 
             
                        attributes[:rows] = attributes[:rows].map { |r| r[:cells].map { |c| c[:value] } }
         | 
| 375 375 | 
             
                      end
         | 
| 376 | 
            +
             | 
| 377 | 
            +
                      def location
         | 
| 378 | 
            +
                        first_line = attributes[:location][:line]
         | 
| 379 | 
            +
                        last_line = first_line + attributes[:rows].length - 1
         | 
| 380 | 
            +
                        Ast::Location.new(file, first_line..last_line)
         | 
| 381 | 
            +
                      end
         | 
| 376 382 | 
             
                    end
         | 
| 377 383 |  | 
| 378 384 | 
             
                    class DocStringBuilder < Builder
         | 
| @@ -6,11 +6,12 @@ module Cucumber | |
| 6 6 | 
             
                module Test
         | 
| 7 7 | 
             
                  module Result
         | 
| 8 8 | 
             
                    TYPES = [:failed, :flaky, :skipped, :undefined, :pending, :passed, :unknown].freeze
         | 
| 9 | 
            +
                    STRICT_AFFECTED_TYPES = [:flaky, :undefined, :pending].freeze
         | 
| 9 10 |  | 
| 10 | 
            -
                    def self.ok?(type, be_strict =  | 
| 11 | 
            +
                    def self.ok?(type, be_strict = StrictConfiguration.new)
         | 
| 11 12 | 
             
                      private
         | 
| 12 13 | 
             
                      class_name = type.to_s.slice(0, 1).capitalize + type.to_s.slice(1..-1)
         | 
| 13 | 
            -
                      const_get(class_name).ok?(be_strict)
         | 
| 14 | 
            +
                      const_get(class_name).ok?(be_strict.strict?(type))
         | 
| 14 15 | 
             
                    end
         | 
| 15 16 |  | 
| 16 17 | 
             
                    # Defines to_sym on a result class for the given result type
         | 
| @@ -67,8 +68,8 @@ module Cucumber | |
| 67 68 | 
             
                        "✓"
         | 
| 68 69 | 
             
                      end
         | 
| 69 70 |  | 
| 70 | 
            -
                      def ok?(be_strict =  | 
| 71 | 
            -
                        self.class.ok? | 
| 71 | 
            +
                      def ok?(be_strict = nil)
         | 
| 72 | 
            +
                        self.class.ok?
         | 
| 72 73 | 
             
                      end
         | 
| 73 74 |  | 
| 74 75 | 
             
                      def with_appended_backtrace(step)
         | 
| @@ -106,8 +107,8 @@ module Cucumber | |
| 106 107 | 
             
                        "✗"
         | 
| 107 108 | 
             
                      end
         | 
| 108 109 |  | 
| 109 | 
            -
                      def ok?(be_strict =  | 
| 110 | 
            -
                        self.class.ok? | 
| 110 | 
            +
                      def ok?(be_strict = nil)
         | 
| 111 | 
            +
                        self.class.ok?
         | 
| 111 112 | 
             
                      end
         | 
| 112 113 |  | 
| 113 114 | 
             
                      def with_duration(new_duration)
         | 
| @@ -164,8 +165,8 @@ module Cucumber | |
| 164 165 | 
             
                        filter.new(dup).exception
         | 
| 165 166 | 
             
                      end
         | 
| 166 167 |  | 
| 167 | 
            -
                      def ok?(be_strict =  | 
| 168 | 
            -
                        self.class.ok?(be_strict)
         | 
| 168 | 
            +
                      def ok?(be_strict = StrictConfiguration.new)
         | 
| 169 | 
            +
                        self.class.ok?(be_strict.strict?(to_sym))
         | 
| 169 170 | 
             
                      end
         | 
| 170 171 | 
             
                    end
         | 
| 171 172 |  | 
| @@ -223,6 +224,54 @@ module Cucumber | |
| 223 224 | 
             
                      end
         | 
| 224 225 | 
             
                    end
         | 
| 225 226 |  | 
| 227 | 
            +
                    # Handles the strict settings for the result types that are
         | 
| 228 | 
            +
                    # affected by the strict options (that is the STRICT_AFFECTED_TYPES).
         | 
| 229 | 
            +
                    class StrictConfiguration
         | 
| 230 | 
            +
                      attr_accessor :settings
         | 
| 231 | 
            +
                      private :settings
         | 
| 232 | 
            +
                      
         | 
| 233 | 
            +
                      def initialize(strict_types = [])
         | 
| 234 | 
            +
                        @settings = Hash[STRICT_AFFECTED_TYPES.map { |t| [t, :default] }]
         | 
| 235 | 
            +
                        strict_types.each do |type|
         | 
| 236 | 
            +
                          set_strict(true, type)
         | 
| 237 | 
            +
                        end
         | 
| 238 | 
            +
                      end
         | 
| 239 | 
            +
             | 
| 240 | 
            +
                      def strict?(type = nil)
         | 
| 241 | 
            +
                        if type.nil?
         | 
| 242 | 
            +
                          settings.each do |_key, value|
         | 
| 243 | 
            +
                            return true if value == true
         | 
| 244 | 
            +
                          end
         | 
| 245 | 
            +
                          false
         | 
| 246 | 
            +
                        else
         | 
| 247 | 
            +
                          return false unless settings.key?(type)
         | 
| 248 | 
            +
                          return false unless set?(type)
         | 
| 249 | 
            +
                          settings[type]
         | 
| 250 | 
            +
                        end
         | 
| 251 | 
            +
                      end
         | 
| 252 | 
            +
             | 
| 253 | 
            +
                      def set_strict(setting, type = nil)
         | 
| 254 | 
            +
                        if type.nil?
         | 
| 255 | 
            +
                          STRICT_AFFECTED_TYPES.each do |t|
         | 
| 256 | 
            +
                            set_strict(setting, t)
         | 
| 257 | 
            +
                          end
         | 
| 258 | 
            +
                        else
         | 
| 259 | 
            +
                          settings[type] = setting
         | 
| 260 | 
            +
                        end
         | 
| 261 | 
            +
                      end
         | 
| 262 | 
            +
             | 
| 263 | 
            +
                      def merge!(other)
         | 
| 264 | 
            +
                        settings.keys.each do |type|
         | 
| 265 | 
            +
                          set_strict(other.strict?(type), type) if other.set?(type)
         | 
| 266 | 
            +
                        end
         | 
| 267 | 
            +
                        self
         | 
| 268 | 
            +
                      end
         | 
| 269 | 
            +
             | 
| 270 | 
            +
                      def set?(type)
         | 
| 271 | 
            +
                        settings[type] != :default
         | 
| 272 | 
            +
                      end
         | 
| 273 | 
            +
                    end
         | 
| 274 | 
            +
             | 
| 226 275 | 
             
                    #
         | 
| 227 276 | 
             
                    # An object that responds to the description protocol from the results
         | 
| 228 277 | 
             
                    # and collects summary information.
         | 
| @@ -250,7 +299,7 @@ module Cucumber | |
| 250 299 | 
             
                        end
         | 
| 251 300 | 
             
                      end
         | 
| 252 301 |  | 
| 253 | 
            -
                      def ok?(be_strict =  | 
| 302 | 
            +
                      def ok?(be_strict = StrictConfiguration.new)
         | 
| 254 303 | 
             
                        TYPES.each do |type|
         | 
| 255 304 | 
             
                          if get_total(type) > 0
         | 
| 256 305 | 
             
                            return false unless Result.ok?(type, be_strict)
         | 
| @@ -15,7 +15,7 @@ module Cucumber | |
| 15 15 | 
             
                    def test_case(test_case, &descend)
         | 
| 16 16 | 
             
                      @running_test_case = RunningTestCase.new
         | 
| 17 17 | 
             
                      @running_test_step = nil
         | 
| 18 | 
            -
                      event_bus. | 
| 18 | 
            +
                      event_bus.test_case_started(test_case)
         | 
| 19 19 | 
             
                      descend.call(self)
         | 
| 20 20 | 
             
                      event_bus.test_case_finished(test_case, running_test_case.result)
         | 
| 21 21 | 
             
                      self
         | 
| @@ -23,7 +23,7 @@ module Cucumber | |
| 23 23 |  | 
| 24 24 | 
             
                    def test_step(test_step)
         | 
| 25 25 | 
             
                      @running_test_step = test_step
         | 
| 26 | 
            -
                      event_bus. | 
| 26 | 
            +
                      event_bus.test_step_started test_step
         | 
| 27 27 | 
             
                      step_result = running_test_case.execute(test_step)
         | 
| 28 28 | 
             
                      event_bus.test_step_finished test_step, step_result
         | 
| 29 29 | 
             
                      @running_test_step = nil
         | 
| @@ -102,7 +102,7 @@ module Cucumber | |
| 102 102 |  | 
| 103 103 | 
             
                          def execute(test_step, monitor, &continue)
         | 
| 104 104 | 
             
                            result = test_step.execute(monitor.result, &continue)
         | 
| 105 | 
            -
                            result = result.with_message(%(Undefined step: "#{test_step. | 
| 105 | 
            +
                            result = result.with_message(%(Undefined step: "#{test_step.text}")) if result.undefined?
         | 
| 106 106 | 
             
                            result = result.with_appended_backtrace(test_step.source.last) if IsStepVisitor.new(test_step).step?
         | 
| 107 107 | 
             
                            result.describe_to(monitor, result)
         | 
| 108 108 | 
             
                          end
         | 
| @@ -9,12 +9,12 @@ module Cucumber | |
| 9 9 | 
             
              module Core
         | 
| 10 10 | 
             
                module Ast
         | 
| 11 11 | 
             
                  describe OutlineStep do
         | 
| 12 | 
            -
                    let(:outline_step) { OutlineStep.new(language, location, comments, keyword,  | 
| 12 | 
            +
                    let(:outline_step) { OutlineStep.new(language, location, comments, keyword, text, multiline_arg) }
         | 
| 13 13 | 
             
                    let(:language) { double }
         | 
| 14 14 | 
             
                    let(:location) { double }
         | 
| 15 15 | 
             
                    let(:comments)  { double }
         | 
| 16 16 | 
             
                    let(:keyword)  { double }
         | 
| 17 | 
            -
                    let(: | 
| 17 | 
            +
                    let(:text)     { 'anything' }
         | 
| 18 18 | 
             
                    let(:multiline_arg) { EmptyMultilineArgument.new }
         | 
| 19 19 |  | 
| 20 20 | 
             
                    describe 'location' do
         | 
| @@ -28,6 +28,12 @@ module Cucumber | |
| 28 28 | 
             
                      end
         | 
| 29 29 | 
             
                    end
         | 
| 30 30 |  | 
| 31 | 
            +
                    describe "to_s" do
         | 
| 32 | 
            +
                      it "returns the text of the step" do
         | 
| 33 | 
            +
                        expect(outline_step.to_s).to eq 'anything'
         | 
| 34 | 
            +
                      end
         | 
| 35 | 
            +
                    end
         | 
| 36 | 
            +
             | 
| 31 37 | 
             
                    describe 'comments' do
         | 
| 32 38 | 
             
                      it "has comments" do
         | 
| 33 39 | 
             
                        expect( outline_step ).to respond_to(:comments)
         | 
| @@ -36,18 +42,18 @@ module Cucumber | |
| 36 42 |  | 
| 37 43 | 
             
                    describe "converting to a Step" do
         | 
| 38 44 | 
             
                      context "a single argument in the name" do
         | 
| 39 | 
            -
                        let(: | 
| 45 | 
            +
                        let(:text) { 'a <color> cucumber' }
         | 
| 40 46 |  | 
| 41 47 | 
             
                        it "replaces the argument" do
         | 
| 42 48 | 
             
                          row = ExamplesTable::Row.new({'color' => 'green'}, 1, location, language, comments)
         | 
| 43 | 
            -
                          expect( outline_step.to_step(row). | 
| 49 | 
            +
                          expect( outline_step.to_step(row).text ).to eq 'a green cucumber'
         | 
| 44 50 | 
             
                        end
         | 
| 45 51 |  | 
| 46 52 | 
             
                      end
         | 
| 47 53 |  | 
| 48 54 | 
             
                      context "when the step has a DataTable" do
         | 
| 49 | 
            -
                        let(:outline_step) { OutlineStep.new(language, location, comments, keyword,  | 
| 50 | 
            -
                        let(: | 
| 55 | 
            +
                        let(:outline_step) { OutlineStep.new(language, location, comments, keyword, text, table) }
         | 
| 56 | 
            +
                        let(:text)  { "anything" }
         | 
| 51 57 | 
             
                        let(:table) { DataTable.new([['x', 'y'],['a', 'a <arg>']], Location.new('foo.feature', 23)) }
         | 
| 52 58 |  | 
| 53 59 | 
             
                        it "replaces the arguments in the DataTable" do
         | 
| @@ -64,9 +70,9 @@ module Cucumber | |
| 64 70 |  | 
| 65 71 | 
             
                      context "when the step has a DocString" do
         | 
| 66 72 | 
             
                        let(:location) { double }
         | 
| 67 | 
            -
                        let(:outline_step) { OutlineStep.new(language, location, comments, keyword,  | 
| 73 | 
            +
                        let(:outline_step) { OutlineStep.new(language, location, comments, keyword, text, doc_string) }
         | 
| 68 74 | 
             
                        let(:doc_string) { DocString.new('a <arg> that needs replacing', '', location) }
         | 
| 69 | 
            -
                        let(: | 
| 75 | 
            +
                        let(:text) { 'anything' }
         | 
| 70 76 |  | 
| 71 77 | 
             
                        it "replaces the arguments in the DocString" do
         | 
| 72 78 | 
             
                          visitor = double
         | 
| @@ -9,9 +9,17 @@ module Cucumber | |
| 9 9 | 
             
                module Ast
         | 
| 10 10 | 
             
                  describe Step do
         | 
| 11 11 | 
             
                    let(:step) do
         | 
| 12 | 
            -
                       | 
| 12 | 
            +
                      text = "a passing step"
         | 
| 13 | 
            +
                      keyword = "Given"
         | 
| 14 | 
            +
                      language, location, comments = *double
         | 
| 13 15 | 
             
                      multiline_arg = EmptyMultilineArgument.new
         | 
| 14 | 
            -
                      Step.new(language, location, comments, keyword,  | 
| 16 | 
            +
                      Step.new(language, location, comments, keyword, text, multiline_arg)
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    describe "to_s" do
         | 
| 20 | 
            +
                      it("returns the text of the step") do
         | 
| 21 | 
            +
                        expect(step.to_s).to eq("a passing step")
         | 
| 22 | 
            +
                      end
         | 
| 15 23 | 
             
                    end
         | 
| 16 24 |  | 
| 17 25 | 
             
                    describe "describing itself" do
         | 
| @@ -109,10 +117,10 @@ module Cucumber | |
| 109 117 | 
             
                  describe ExpandedOutlineStep do
         | 
| 110 118 | 
             
                    let(:outline_step) { double }
         | 
| 111 119 | 
             
                    let(:step) do
         | 
| 112 | 
            -
                      language, location, keyword,  | 
| 120 | 
            +
                      language, location, keyword, text = *double
         | 
| 113 121 | 
             
                      multiline_arg = EmptyMultilineArgument.new
         | 
| 114 122 | 
             
                      comments = []
         | 
| 115 | 
            -
                      ExpandedOutlineStep.new(outline_step, language, location, comments, keyword,  | 
| 123 | 
            +
                      ExpandedOutlineStep.new(outline_step, language, location, comments, keyword, text, multiline_arg)
         | 
| 116 124 | 
             
                    end
         | 
| 117 125 |  | 
| 118 126 | 
             
                    describe "describing itself" do
         | 
| @@ -139,7 +139,7 @@ module Cucumber::Core | |
| 139 139 | 
             
                      expect( visitor ).to receive(:test_step) do |test_step|
         | 
| 140 140 | 
             
                        visit_source(test_step) do |source_visitor|
         | 
| 141 141 | 
             
                          expect( source_visitor ).to receive(:step) do |step|
         | 
| 142 | 
            -
                            expect(step. | 
| 142 | 
            +
                            expect(step.text).to eq 'passing 1 with 2'
         | 
| 143 143 | 
             
                          end
         | 
| 144 144 | 
             
                        end
         | 
| 145 145 | 
             
                      end.once.ordered
         | 
| @@ -147,7 +147,7 @@ module Cucumber::Core | |
| 147 147 | 
             
                      expect( visitor ).to receive(:test_step) do |test_step|
         | 
| 148 148 | 
             
                        visit_source(test_step) do |source_visitor|
         | 
| 149 149 | 
             
                          expect( source_visitor ).to receive(:step) do |step|
         | 
| 150 | 
            -
                            expect(step. | 
| 150 | 
            +
                            expect(step.text).to eq 'as well as 3'
         | 
| 151 151 | 
             
                          end
         | 
| 152 152 | 
             
                        end
         | 
| 153 153 | 
             
                      end.once.ordered
         | 
| @@ -157,6 +157,23 @@ module Cucumber::Core | |
| 157 157 | 
             
                  end
         | 
| 158 158 | 
             
                end
         | 
| 159 159 |  | 
| 160 | 
            +
                context 'empty scenarios' do
         | 
| 161 | 
            +
                  it 'does not create test cases for them' do
         | 
| 162 | 
            +
                    gherkin_documents = [
         | 
| 163 | 
            +
                      gherkin do
         | 
| 164 | 
            +
                        feature do
         | 
| 165 | 
            +
                          scenario do
         | 
| 166 | 
            +
                          end
         | 
| 167 | 
            +
                        end
         | 
| 168 | 
            +
                      end
         | 
| 169 | 
            +
                    ]
         | 
| 170 | 
            +
                    compile(gherkin_documents) do |visitor|
         | 
| 171 | 
            +
                      expect( visitor ).to receive(:test_case).never
         | 
| 172 | 
            +
                      expect( visitor ).to receive(:done).once.ordered
         | 
| 173 | 
            +
                    end
         | 
| 174 | 
            +
                  end
         | 
| 175 | 
            +
                end
         | 
| 176 | 
            +
             | 
| 160 177 | 
             
                describe Compiler::FeatureCompiler do
         | 
| 161 178 | 
             
                  let(:receiver) { double('receiver') }
         | 
| 162 179 | 
             
                  let(:compiler) { Compiler::FeatureCompiler.new(receiver) }
         | 
| @@ -30,7 +30,7 @@ module Cucumber::Core | |
| 30 30 | 
             
                    my_filter = my_filter_class.new
         | 
| 31 31 | 
             
                    expect(receiver).to receive(:test_case) { |test_case|
         | 
| 32 32 | 
             
                      expect(test_case.test_steps.length).to eq 1
         | 
| 33 | 
            -
                      expect(test_case.test_steps.first. | 
| 33 | 
            +
                      expect(test_case.test_steps.first.text).to eq 'a step'
         | 
| 34 34 | 
             
                    }.exactly(2).times
         | 
| 35 35 | 
             
                    compile [doc], receiver, [my_filter]
         | 
| 36 36 | 
             
                  end
         | 
| @@ -197,7 +197,7 @@ module Cucumber | |
| 197 197 | 
             
                        allow( visitor ).to receive(:scenario_outline).and_yield(visitor)
         | 
| 198 198 | 
             
                        allow( visitor ).to receive(:examples_table)
         | 
| 199 199 | 
             
                        expect( visitor ).to receive(:outline_step) do |step|
         | 
| 200 | 
            -
                          expect( step. | 
| 200 | 
            +
                          expect( step.text ).to eq 'passing <arg>'
         | 
| 201 201 | 
             
                        end
         | 
| 202 202 | 
             
                        feature.describe_to(visitor)
         | 
| 203 203 | 
             
                      end
         | 
| @@ -159,14 +159,16 @@ module Cucumber::Core::Report | |
| 159 159 | 
             
                    event_bus.send(:test_case_finished, test_case, pending_result)
         | 
| 160 160 |  | 
| 161 161 | 
             
                    expect( @summary.ok? ).to eq true
         | 
| 162 | 
            -
                     | 
| 162 | 
            +
                    be_strict = ::Cucumber::Core::Test::Result::StrictConfiguration.new([:pending])
         | 
| 163 | 
            +
                    expect( @summary.ok?(be_strict) ).to eq false
         | 
| 163 164 | 
             
                  end
         | 
| 164 165 |  | 
| 165 166 | 
             
                  it "undefined test case is ok if not strict" do
         | 
| 166 167 | 
             
                    event_bus.send(:test_case_finished, test_case, undefined_result)
         | 
| 167 168 |  | 
| 168 169 | 
             
                    expect( @summary.ok? ).to eq true
         | 
| 169 | 
            -
                     | 
| 170 | 
            +
                    be_strict = ::Cucumber::Core::Test::Result::StrictConfiguration.new([:undefined])
         | 
| 171 | 
            +
                    expect( @summary.ok?(be_strict) ).to eq false
         | 
| 170 172 | 
             
                  end
         | 
| 171 173 | 
             
                end
         | 
| 172 174 | 
             
              end
         | 
| @@ -277,7 +277,7 @@ module Cucumber | |
| 277 277 | 
             
                        gherkin = Gherkin::Document.new('features/treasure.feature', %{# language: en-pirate
         | 
| 278 278 | 
             
                          Ahoy matey!: Treasure map
         | 
| 279 279 | 
             
                            Heave to: Find the treasure
         | 
| 280 | 
            -
                              Gangway | 
| 280 | 
            +
                              Gangway! a map
         | 
| 281 281 | 
             
                        })
         | 
| 282 282 | 
             
                        receiver = double.as_null_object
         | 
| 283 283 | 
             
                        expect( receiver ).to receive(:test_case) do |test_case|
         | 
| @@ -96,8 +96,8 @@ module Cucumber::Core | |
| 96 96 | 
             
                            Given a table
         | 
| 97 97 | 
             
                              | a | b |
         | 
| 98 98 | 
             
                              | 1 | 2 |
         | 
| 99 | 
            +
                              | 3 | 4 |
         | 
| 99 100 |  | 
| 100 | 
            -
                          Scenario: empty
         | 
| 101 101 | 
             
                      END
         | 
| 102 102 | 
             
                    end
         | 
| 103 103 |  | 
| @@ -112,13 +112,6 @@ module Cucumber::Core | |
| 112 112 | 
             
                      expect(receiver.test_case_locations).to eq [test_case_named('two').location]
         | 
| 113 113 | 
             
                    end
         | 
| 114 114 |  | 
| 115 | 
            -
                    it 'matches the precise location of an empty scenario' do
         | 
| 116 | 
            -
                      location = test_case_named('empty').location
         | 
| 117 | 
            -
                      filter = Test::LocationsFilter.new([location])
         | 
| 118 | 
            -
                      compile [doc], receiver, [filter]
         | 
| 119 | 
            -
                      expect(receiver.test_case_locations).to eq [test_case_named('empty').location]
         | 
| 120 | 
            -
                    end
         | 
| 121 | 
            -
             | 
| 122 115 | 
             
                    it 'matches multiple locations' do
         | 
| 123 116 | 
             
                      good_location = Ast::Location.new(file, 8)
         | 
| 124 117 | 
             
                      bad_location = Ast::Location.new(file, 5)
         | 
| @@ -201,10 +194,25 @@ module Cucumber::Core | |
| 201 194 | 
             
                        test_cases.find { |c| c.name == 'with a table' }
         | 
| 202 195 | 
             
                      end
         | 
| 203 196 |  | 
| 204 | 
            -
                      it "matches a location  | 
| 197 | 
            +
                      it "matches a location at the start of the table" do
         | 
| 205 198 | 
             
                        location = Ast::Location.new(file, 23)
         | 
| 206 199 | 
             
                        expect( test_case.match_locations?([location]) ).to be_truthy
         | 
| 207 200 | 
             
                      end
         | 
| 201 | 
            +
             | 
| 202 | 
            +
                      it "matches a location in the middle of the table" do
         | 
| 203 | 
            +
                        location = Ast::Location.new(file, 24)
         | 
| 204 | 
            +
                        expect( test_case.match_locations?([location]) ).to be_truthy
         | 
| 205 | 
            +
                      end
         | 
| 206 | 
            +
             | 
| 207 | 
            +
                      it "matches a location at the end of the table" do
         | 
| 208 | 
            +
                        location = Ast::Location.new(file, 25)
         | 
| 209 | 
            +
                        expect( test_case.match_locations?([location]) ).to be_truthy
         | 
| 210 | 
            +
                      end
         | 
| 211 | 
            +
             | 
| 212 | 
            +
                      it "does not match a location after the table" do
         | 
| 213 | 
            +
                        location = Ast::Location.new(file, 26)
         | 
| 214 | 
            +
                        expect( test_case.match_locations?([location]) ).to be_falsey
         | 
| 215 | 
            +
                      end
         | 
| 208 216 | 
             
                    end
         | 
| 209 217 |  | 
| 210 218 | 
             
                    context "with duplicate locations in the filter" do
         | 
| @@ -49,8 +49,7 @@ module Cucumber::Core::Test | |
| 49 49 | 
             
                  specify { expect( result ).not_to be_flaky     }
         | 
| 50 50 |  | 
| 51 51 | 
             
                  specify { expect( result ).to be_ok }
         | 
| 52 | 
            -
                  specify { expect( result.ok? | 
| 53 | 
            -
                  specify { expect( result.ok?(true) ).to be_truthy }
         | 
| 52 | 
            +
                  specify { expect( result.ok? ).to be_truthy }
         | 
| 54 53 | 
             
                end
         | 
| 55 54 |  | 
| 56 55 | 
             
                describe Result::Failed do
         | 
| @@ -109,8 +108,7 @@ module Cucumber::Core::Test | |
| 109 108 | 
             
                  specify { expect( result ).not_to be_flaky     }
         | 
| 110 109 |  | 
| 111 110 | 
             
                  specify { expect( result ).to_not be_ok }
         | 
| 112 | 
            -
                  specify { expect( result.ok? | 
| 113 | 
            -
                  specify { expect( result.ok?(true) ).to be_falsey }
         | 
| 111 | 
            +
                  specify { expect( result.ok? ).to be_falsey }
         | 
| 114 112 | 
             
                end
         | 
| 115 113 |  | 
| 116 114 | 
             
                describe Result::Unknown do
         | 
| @@ -202,8 +200,9 @@ module Cucumber::Core::Test | |
| 202 200 | 
             
                  specify { expect( result ).not_to be_flaky     }
         | 
| 203 201 |  | 
| 204 202 | 
             
                  specify { expect( result ).to be_ok }
         | 
| 205 | 
            -
                  specify { expect( result.ok? | 
| 206 | 
            -
                   | 
| 203 | 
            +
                  specify { expect( result.ok? ).to be_truthy }
         | 
| 204 | 
            +
                  be_strict = Result::StrictConfiguration.new([:undefined])
         | 
| 205 | 
            +
                  specify { expect( result.ok?(be_strict) ).to be_falsey }
         | 
| 207 206 | 
             
                end
         | 
| 208 207 |  | 
| 209 208 | 
             
                describe Result::Skipped do
         | 
| @@ -225,8 +224,7 @@ module Cucumber::Core::Test | |
| 225 224 | 
             
                  specify { expect( result ).not_to be_flaky     }
         | 
| 226 225 |  | 
| 227 226 | 
             
                  specify { expect( result ).to be_ok }
         | 
| 228 | 
            -
                  specify { expect( result.ok? | 
| 229 | 
            -
                  specify { expect( result.ok?(true) ).to be_truthy }
         | 
| 227 | 
            +
                  specify { expect( result.ok? ).to be_truthy }
         | 
| 230 228 | 
             
                end
         | 
| 231 229 |  | 
| 232 230 | 
             
                describe Result::Pending do
         | 
| @@ -249,8 +247,9 @@ module Cucumber::Core::Test | |
| 249 247 | 
             
                  specify { expect( result ).to     be_pending   }
         | 
| 250 248 |  | 
| 251 249 | 
             
                  specify { expect( result ).to be_ok }
         | 
| 252 | 
            -
                  specify { expect( result.ok? | 
| 253 | 
            -
                   | 
| 250 | 
            +
                  specify { expect( result.ok? ).to be_truthy }
         | 
| 251 | 
            +
                  be_strict = Result::StrictConfiguration.new([:pending])
         | 
| 252 | 
            +
                  specify { expect( result.ok?(be_strict) ).to be_falsey }
         | 
| 254 253 | 
             
                end
         | 
| 255 254 |  | 
| 256 255 | 
             
                describe Result::Flaky do
         | 
| @@ -258,6 +257,77 @@ module Cucumber::Core::Test | |
| 258 257 | 
             
                  specify { expect( Result::Flaky.ok?(true) ).to be_falsey }
         | 
| 259 258 | 
             
                end
         | 
| 260 259 |  | 
| 260 | 
            +
                describe Result::StrictConfiguration do
         | 
| 261 | 
            +
                  subject(:strict_configuration) { Result::StrictConfiguration.new}
         | 
| 262 | 
            +
                  
         | 
| 263 | 
            +
                  describe '#set_strict' do
         | 
| 264 | 
            +
                    context 'no type argument' do
         | 
| 265 | 
            +
                      it 'sets all result types to the setting argument' do
         | 
| 266 | 
            +
                        strict_configuration.set_strict(true)
         | 
| 267 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_truthy
         | 
| 268 | 
            +
                        expect( strict_configuration.strict?(:pending) ).to be_truthy
         | 
| 269 | 
            +
                        expect( strict_configuration.strict?(:flaky) ).to be_truthy
         | 
| 270 | 
            +
             | 
| 271 | 
            +
                        strict_configuration.set_strict(false)
         | 
| 272 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_falsey
         | 
| 273 | 
            +
                        expect( strict_configuration.strict?(:pending) ).to be_falsey
         | 
| 274 | 
            +
                        expect( strict_configuration.strict?(:flaky) ).to be_falsey
         | 
| 275 | 
            +
                      end
         | 
| 276 | 
            +
                    end
         | 
| 277 | 
            +
                    context 'with type argument' do
         | 
| 278 | 
            +
                      it 'sets the specified result type to the setting argument' do
         | 
| 279 | 
            +
                        strict_configuration.set_strict(true, :undefined)
         | 
| 280 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_truthy
         | 
| 281 | 
            +
                        expect( strict_configuration.set?(:pending) ).to be_falsey
         | 
| 282 | 
            +
                        expect( strict_configuration.set?(:flaky) ).to be_falsey
         | 
| 283 | 
            +
             | 
| 284 | 
            +
                        strict_configuration.set_strict(false, :undefined)
         | 
| 285 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_falsey
         | 
| 286 | 
            +
                        expect( strict_configuration.set?(:pending) ).to be_falsey
         | 
| 287 | 
            +
                        expect( strict_configuration.set?(:flaky) ).to be_falsey
         | 
| 288 | 
            +
                      end
         | 
| 289 | 
            +
                    end
         | 
| 290 | 
            +
                  end
         | 
| 291 | 
            +
             | 
| 292 | 
            +
                  describe '#strict?' do
         | 
| 293 | 
            +
                    context 'no type argument' do
         | 
| 294 | 
            +
                      it 'returns true if any result type is set to strict' do
         | 
| 295 | 
            +
                        strict_configuration.set_strict(false, :pending)
         | 
| 296 | 
            +
                        expect( strict_configuration.strict? ).to be_falsey
         | 
| 297 | 
            +
             | 
| 298 | 
            +
                        strict_configuration.set_strict(true, :flaky)
         | 
| 299 | 
            +
                        expect( strict_configuration.strict? ).to be_truthy
         | 
| 300 | 
            +
                      end
         | 
| 301 | 
            +
                    end
         | 
| 302 | 
            +
                    context 'with type argument' do
         | 
| 303 | 
            +
                      it 'returns true if the specified result type is set to strict' do
         | 
| 304 | 
            +
                        strict_configuration.set_strict(false, :pending)
         | 
| 305 | 
            +
                        strict_configuration.set_strict(true, :flaky)
         | 
| 306 | 
            +
             | 
| 307 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_falsey
         | 
| 308 | 
            +
                        expect( strict_configuration.strict?(:pending) ).to be_falsey
         | 
| 309 | 
            +
                        expect( strict_configuration.strict?(:flaky) ).to be_truthy
         | 
| 310 | 
            +
                      end
         | 
| 311 | 
            +
                    end
         | 
| 312 | 
            +
                  end
         | 
| 313 | 
            +
             | 
| 314 | 
            +
                  describe '#merge!' do
         | 
| 315 | 
            +
                    let(:merged_configuration) { Result::StrictConfiguration.new }
         | 
| 316 | 
            +
                    it 'sets the not default values from the argument accordingly' do
         | 
| 317 | 
            +
                        strict_configuration.set_strict(false, :undefined)
         | 
| 318 | 
            +
                        strict_configuration.set_strict(false, :pending)
         | 
| 319 | 
            +
                        strict_configuration.set_strict(true, :flaky)
         | 
| 320 | 
            +
                        merged_configuration.set_strict(true, :pending)
         | 
| 321 | 
            +
                        merged_configuration.set_strict(false, :flaky)
         | 
| 322 | 
            +
                        strict_configuration.merge!(merged_configuration)
         | 
| 323 | 
            +
             | 
| 324 | 
            +
                        expect( strict_configuration.strict?(:undefined) ).to be_falsey
         | 
| 325 | 
            +
                        expect( strict_configuration.strict?(:pending) ).to be_truthy
         | 
| 326 | 
            +
                        expect( strict_configuration.strict?(:flaky) ).to be_falsey
         | 
| 327 | 
            +
                    end
         | 
| 328 | 
            +
                  end
         | 
| 329 | 
            +
                end
         | 
| 330 | 
            +
             | 
| 261 331 | 
             
                describe Result::Summary do
         | 
| 262 332 | 
             
                  let(:summary)   { Result::Summary.new }
         | 
| 263 333 | 
             
                  let(:failed)    { Result::Failed.new(Result::Duration.new(10), exception) }
         | 
| @@ -360,19 +430,22 @@ module Cucumber::Core::Test | |
| 360 430 | 
             
                    it "pending result is ok if not strict" do
         | 
| 361 431 | 
             
                      pending.describe_to summary
         | 
| 362 432 | 
             
                      expect( summary.ok? ).to be true
         | 
| 363 | 
            -
                       | 
| 433 | 
            +
                      be_strict = Result::StrictConfiguration.new([:pending])
         | 
| 434 | 
            +
                      expect( summary.ok?(be_strict) ).to be false
         | 
| 364 435 | 
             
                    end
         | 
| 365 436 |  | 
| 366 437 | 
             
                    it "undefined result is ok if not strict" do
         | 
| 367 438 | 
             
                      undefined.describe_to summary
         | 
| 368 439 | 
             
                      expect( summary.ok? ).to be true
         | 
| 369 | 
            -
                       | 
| 440 | 
            +
                      be_strict = Result::StrictConfiguration.new([:undefined])
         | 
| 441 | 
            +
                      expect( summary.ok?(be_strict) ).to be false
         | 
| 370 442 | 
             
                    end
         | 
| 371 443 |  | 
| 372 444 | 
             
                    it "flaky result is ok if not strict" do
         | 
| 373 445 | 
             
                      summary.flaky
         | 
| 374 446 | 
             
                      expect( summary.ok? ).to be true
         | 
| 375 | 
            -
                       | 
| 447 | 
            +
                      be_strict = Result::StrictConfiguration.new([:flaky])
         | 
| 448 | 
            +
                      expect( summary.ok?(be_strict) ).to be false
         | 
| 376 449 | 
             
                    end
         | 
| 377 450 | 
             
                  end
         | 
| 378 451 | 
             
                end
         | 
| @@ -19,7 +19,7 @@ module Cucumber::Core::Test | |
| 19 19 | 
             
                let(:exception) { StandardError.new('test error') }
         | 
| 20 20 |  | 
| 21 21 | 
             
                before do
         | 
| 22 | 
            -
                  allow(event_bus).to receive(: | 
| 22 | 
            +
                  allow(event_bus).to receive(:test_case_started)
         | 
| 23 23 | 
             
                  allow(source).to receive(:location)
         | 
| 24 24 | 
             
                end
         | 
| 25 25 |  | 
| @@ -66,8 +66,8 @@ module Cucumber::Core::Test | |
| 66 66 | 
             
                  context "without steps" do
         | 
| 67 67 | 
             
                    let(:test_steps) { [] }
         | 
| 68 68 |  | 
| 69 | 
            -
                    it "emits a  | 
| 70 | 
            -
                      expect(event_bus).to receive(: | 
| 69 | 
            +
                    it "emits a test_case_started event before running the test case" do
         | 
| 70 | 
            +
                      expect(event_bus).to receive(:test_case_started).with(test_case)
         | 
| 71 71 | 
             
                      test_case.describe_to runner
         | 
| 72 72 | 
             
                    end
         | 
| 73 73 |  | 
| @@ -99,7 +99,7 @@ module Cucumber::Core::Test | |
| 99 99 | 
             
                        expect(event_bus).to receive(:test_case_finished) do |test_case, result|
         | 
| 100 100 | 
             
                          expect( result ).to be_undefined
         | 
| 101 101 | 
             
                        end
         | 
| 102 | 
            -
                        allow( undefined.source.last ).to receive(: | 
| 102 | 
            +
                        allow( undefined.source.last ).to receive(:text)
         | 
| 103 103 | 
             
                        test_case.describe_to runner
         | 
| 104 104 | 
             
                      end
         | 
| 105 105 |  | 
| @@ -107,7 +107,7 @@ module Cucumber::Core::Test | |
| 107 107 | 
             
                        expect(event_bus).to receive(:test_case_finished) do |test_case, result|
         | 
| 108 108 | 
             
                          expect( result.message ).to eq("Undefined step: \"step name\"")
         | 
| 109 109 | 
             
                        end
         | 
| 110 | 
            -
                        expect( undefined.source.last ).to receive(: | 
| 110 | 
            +
                        expect( undefined.source.last ).to receive(:text).and_return("step name")
         | 
| 111 111 | 
             
                        test_case.describe_to runner
         | 
| 112 112 | 
             
                      end
         | 
| 113 113 |  | 
| @@ -116,7 +116,7 @@ module Cucumber::Core::Test | |
| 116 116 | 
             
                          expect( result.backtrace ).to eq(["step line"])
         | 
| 117 117 | 
             
                        end
         | 
| 118 118 | 
             
                        expect( undefined.source.last ).to receive(:backtrace_line).and_return("step line")
         | 
| 119 | 
            -
                        allow( undefined.source.last ).to receive(: | 
| 119 | 
            +
                        allow( undefined.source.last ).to receive(:text)
         | 
| 120 120 | 
             
                        test_case.describe_to runner
         | 
| 121 121 | 
             
                      end
         | 
| 122 122 | 
             
                    end
         | 
| @@ -73,11 +73,11 @@ module Cucumber::Core::Test | |
| 73 73 | 
             
                  end
         | 
| 74 74 | 
             
                end
         | 
| 75 75 |  | 
| 76 | 
            -
                it "exposes the  | 
| 77 | 
            -
                   | 
| 78 | 
            -
                  step_or_hook = double( | 
| 76 | 
            +
                it "exposes the text and location of the AST step or hook as attributes" do
         | 
| 77 | 
            +
                  text, location = double, double
         | 
| 78 | 
            +
                  step_or_hook = double(text: text, location: location)
         | 
| 79 79 | 
             
                  test_step = Step.new([step_or_hook])
         | 
| 80 | 
            -
                  expect( test_step. | 
| 80 | 
            +
                  expect( test_step.text     ).to eq text
         | 
| 81 81 | 
             
                  expect( test_step.location ).to eq location
         | 
| 82 82 | 
             
                end
         | 
| 83 83 |  | 
| @@ -88,5 +88,11 @@ module Cucumber::Core::Test | |
| 88 88 | 
             
                  expect( test_step.action_location ).to eq location
         | 
| 89 89 | 
             
                end
         | 
| 90 90 |  | 
| 91 | 
            +
                it "returns the text of the AST step when converted to a string" do
         | 
| 92 | 
            +
                  ast_step = double(text: 'a passing step', location: double)
         | 
| 93 | 
            +
                  test_step = Step.new([ast_step])
         | 
| 94 | 
            +
                  expect( test_step.to_s     ).to eq 'a passing step'
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 91 97 | 
             
              end
         | 
| 92 98 | 
             
            end
         | 
    
        data/spec/cucumber/core_spec.rb
    CHANGED
    
    | @@ -99,37 +99,37 @@ module Cucumber | |
| 99 99 |  | 
| 100 100 | 
             
                    observed_events = []
         | 
| 101 101 | 
             
                    execute [gherkin], [Core::Test::Filters::ActivateStepsForSelfTest.new] do |event_bus|
         | 
| 102 | 
            -
                      event_bus.on(: | 
| 102 | 
            +
                      event_bus.on(:test_case_started) do |event|
         | 
| 103 103 | 
             
                        test_case = event.test_case
         | 
| 104 | 
            -
                        observed_events << [: | 
| 104 | 
            +
                        observed_events << [:test_case_started, test_case.name]
         | 
| 105 105 | 
             
                      end
         | 
| 106 106 | 
             
                      event_bus.on(:test_case_finished) do |event|
         | 
| 107 107 | 
             
                        test_case, result = *event.attributes
         | 
| 108 108 | 
             
                        observed_events << [:test_case_finished, test_case.name, result.to_sym]
         | 
| 109 109 | 
             
                      end
         | 
| 110 | 
            -
                      event_bus.on(: | 
| 110 | 
            +
                      event_bus.on(:test_step_started) do |event|
         | 
| 111 111 | 
             
                        test_step = event.test_step
         | 
| 112 | 
            -
                        observed_events << [: | 
| 112 | 
            +
                        observed_events << [:test_step_started, test_step.text]
         | 
| 113 113 | 
             
                      end
         | 
| 114 114 | 
             
                      event_bus.on(:test_step_finished) do |event|
         | 
| 115 115 | 
             
                        test_step, result = *event.attributes
         | 
| 116 | 
            -
                        observed_events << [:test_step_finished, test_step. | 
| 116 | 
            +
                        observed_events << [:test_step_finished, test_step.text, result.to_sym]
         | 
| 117 117 | 
             
                      end
         | 
| 118 118 | 
             
                    end
         | 
| 119 119 |  | 
| 120 120 | 
             
                    expect(observed_events).to eq [
         | 
| 121 | 
            -
                      [: | 
| 122 | 
            -
                      [: | 
| 121 | 
            +
                      [:test_case_started, 'The one that passes'],
         | 
| 122 | 
            +
                      [:test_step_started, 'passing'],
         | 
| 123 123 | 
             
                      [:test_step_finished, 'passing', :passed],
         | 
| 124 124 | 
             
                      [:test_case_finished, 'The one that passes', :passed],
         | 
| 125 | 
            -
                      [: | 
| 126 | 
            -
                      [: | 
| 125 | 
            +
                      [:test_case_started, 'The one that fails'],
         | 
| 126 | 
            +
                      [:test_step_started, 'passing'],
         | 
| 127 127 | 
             
                      [:test_step_finished, 'passing', :passed],
         | 
| 128 | 
            -
                      [: | 
| 128 | 
            +
                      [:test_step_started, 'failing'],
         | 
| 129 129 | 
             
                      [:test_step_finished, 'failing', :failed],
         | 
| 130 | 
            -
                      [: | 
| 130 | 
            +
                      [:test_step_started, 'passing'],
         | 
| 131 131 | 
             
                      [:test_step_finished, 'passing', :skipped],
         | 
| 132 | 
            -
                      [: | 
| 132 | 
            +
                      [:test_step_started, 'undefined'],
         | 
| 133 133 | 
             
                      [:test_step_finished, 'undefined', :undefined],
         | 
| 134 134 | 
             
                      [:test_case_finished, 'The one that fails', :failed],
         | 
| 135 135 | 
             
                    ]
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cucumber-core
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 3.0.0 | 
| 4 | 
            +
              version: 3.0.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Aslak Hellesøy
         | 
| @@ -12,7 +12,7 @@ authors: | |
| 12 12 | 
             
            autorequire: 
         | 
| 13 13 | 
             
            bindir: bin
         | 
| 14 14 | 
             
            cert_chain: []
         | 
| 15 | 
            -
            date: 2017- | 
| 15 | 
            +
            date: 2017-09-27 00:00:00.000000000 Z
         | 
| 16 16 | 
             
            dependencies:
         | 
| 17 17 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 18 18 | 
             
              name: gherkin
         | 
| @@ -167,9 +167,9 @@ files: | |
| 167 167 | 
             
            - ".ruby-gemset"
         | 
| 168 168 | 
             
            - ".travis.yml"
         | 
| 169 169 | 
             
            - ".yardopts"
         | 
| 170 | 
            +
            - CHANGELOG.md
         | 
| 170 171 | 
             
            - CONTRIBUTING.md
         | 
| 171 172 | 
             
            - Gemfile
         | 
| 172 | 
            -
            - HISTORY.md
         | 
| 173 173 | 
             
            - LICENSE
         | 
| 174 174 | 
             
            - README.md
         | 
| 175 175 | 
             
            - Rakefile
         | 
| @@ -262,15 +262,15 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 262 262 | 
             
                  version: 1.9.3
         | 
| 263 263 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 264 264 | 
             
              requirements:
         | 
| 265 | 
            -
              - - " | 
| 265 | 
            +
              - - ">="
         | 
| 266 266 | 
             
                - !ruby/object:Gem::Version
         | 
| 267 | 
            -
                  version:  | 
| 267 | 
            +
                  version: '0'
         | 
| 268 268 | 
             
            requirements: []
         | 
| 269 269 | 
             
            rubyforge_project: 
         | 
| 270 | 
            -
            rubygems_version: 2. | 
| 270 | 
            +
            rubygems_version: 2.5.1
         | 
| 271 271 | 
             
            signing_key: 
         | 
| 272 272 | 
             
            specification_version: 4
         | 
| 273 | 
            -
            summary: cucumber-core-3.0.0 | 
| 273 | 
            +
            summary: cucumber-core-3.0.0
         | 
| 274 274 | 
             
            test_files:
         | 
| 275 275 | 
             
            - spec/capture_warnings.rb
         | 
| 276 276 | 
             
            - spec/coverage.rb
         |