turnip 4.0.1 → 4.1.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/README.md +11 -0
- data/lib/turnip/builder.rb +8 -3
- data/lib/turnip/node/feature.rb +1 -1
- data/lib/turnip/node/rule.rb +1 -1
- data/lib/turnip/node/tag.rb +1 -1
- data/lib/turnip/placeholder.rb +5 -0
- data/lib/turnip/version.rb +1 -1
- data/spec/placeholder_spec.rb +17 -0
- data/spec/step_definition_spec.rb +2 -0
- data/turnip.gemspec +1 -3
- metadata +6 -7
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4140426c0b56837adcc9a4e2e9535fcbfd265aa53067be71f74475a03c06eafb
         | 
| 4 | 
            +
              data.tar.gz: bd0e23b3d6f26c8755345147fdd2c455f09302ac645a0bafcd17e38ad2e713d1
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 7a98529bd8e3e2021baeadf51a4a2b94164b34127953612e4010b4fd0e937f5afbc664b881d458e143dcd74a38d290ead78159cc8d017fcb34282bc33cc21bee
         | 
| 7 | 
            +
              data.tar.gz: 687d9f88818ddb37c2143a9b97165104fd612fd8a35d1783df834c45727a55df64ae31748fe085e8b7f2ec7954d41e5012fe70553f8fa5f9223982ec9d31332d
         | 
    
        data/README.md
    CHANGED
    
    | @@ -425,6 +425,17 @@ step "there are the following monsters:" do |table| | |
| 425 425 | 
             
            end
         | 
| 426 426 | 
             
            ```
         | 
| 427 427 |  | 
| 428 | 
            +
            or the equivalent:
         | 
| 429 | 
            +
             | 
| 430 | 
            +
            ``` ruby
         | 
| 431 | 
            +
            step "there are the following monsters:" do |table|
         | 
| 432 | 
            +
              @monsters = {}
         | 
| 433 | 
            +
              table.rows.each do |(name, hp)|
         | 
| 434 | 
            +
                @monsters[name] = hp.to_i
         | 
| 435 | 
            +
              end
         | 
| 436 | 
            +
            end
         | 
| 437 | 
            +
            ```
         | 
| 438 | 
            +
             | 
| 428 439 | 
             
            ## Unimplemented steps
         | 
| 429 440 | 
             
            Turnip mark a scenario as pending when steps in the scenario is not implemented.
         | 
| 430 441 | 
             
            If you sets `raise_error_for_unimplemented_steps` as `true`, turnip will mark a scenario as fail.
         | 
    
        data/lib/turnip/builder.rb
    CHANGED
    
    | @@ -1,11 +1,16 @@ | |
| 1 | 
            -
            require "gherkin | 
| 1 | 
            +
            require "gherkin"
         | 
| 2 2 | 
             
            require 'turnip/node/feature'
         | 
| 3 3 |  | 
| 4 4 | 
             
            module Turnip
         | 
| 5 5 | 
             
              class Builder
         | 
| 6 6 | 
             
                def self.build(feature_file)
         | 
| 7 | 
            -
                  messages = Gherkin | 
| 8 | 
            -
             | 
| 7 | 
            +
                  messages = Gherkin.from_paths(
         | 
| 8 | 
            +
                    [feature_file],
         | 
| 9 | 
            +
                    include_source: false,
         | 
| 10 | 
            +
                    include_gherkin_document: true,
         | 
| 11 | 
            +
                    include_pickles: false
         | 
| 12 | 
            +
                  )
         | 
| 13 | 
            +
                  result = messages.first&.gherkin_document&.to_hash
         | 
| 9 14 |  | 
| 10 15 | 
             
                  return nil if result.nil? || result[:feature].nil?
         | 
| 11 16 | 
             
                  Node::Feature.new(result[:feature])
         | 
    
        data/lib/turnip/node/feature.rb
    CHANGED
    
    
    
        data/lib/turnip/node/rule.rb
    CHANGED
    
    | @@ -22,7 +22,7 @@ module Turnip | |
| 22 22 | 
             
                      end
         | 
| 23 23 |  | 
| 24 24 | 
             
                      unless child[:scenario].nil?
         | 
| 25 | 
            -
                        klass = child | 
| 25 | 
            +
                        klass = child.dig(:scenario, :examples).nil? ? Scenario : ScenarioOutline
         | 
| 26 26 | 
             
                        next klass.new(child[:scenario])
         | 
| 27 27 | 
             
                      end
         | 
| 28 28 | 
             
                    end.compact
         | 
    
        data/lib/turnip/node/tag.rb
    CHANGED
    
    
    
        data/lib/turnip/placeholder.rb
    CHANGED
    
    | @@ -4,6 +4,11 @@ module Turnip | |
| 4 4 |  | 
| 5 5 | 
             
                class << self
         | 
| 6 6 | 
             
                  def add(name, &block)
         | 
| 7 | 
            +
                    if placeholders.key?(name)
         | 
| 8 | 
            +
                      location = caller_locations.detect { |l| l.to_s !~ /lib\/turnip\/dsl\.rb/ }
         | 
| 9 | 
            +
                      warn "Placeholder :#{name} was replaced at #{location}."
         | 
| 10 | 
            +
                    end
         | 
| 11 | 
            +
             | 
| 7 12 | 
             
                    placeholders[name] = Placeholder.new(name, &block)
         | 
| 8 13 | 
             
                  end
         | 
| 9 14 |  | 
    
        data/lib/turnip/version.rb
    CHANGED
    
    
    
        data/spec/placeholder_spec.rb
    CHANGED
    
    | @@ -9,6 +9,8 @@ describe Turnip::Placeholder do | |
| 9 9 | 
             
                  end
         | 
| 10 10 | 
             
                end
         | 
| 11 11 |  | 
| 12 | 
            +
                after { Turnip::Placeholder.send(:placeholders).clear }
         | 
| 13 | 
            +
             | 
| 12 14 | 
             
                it 'returns a regexp for the given placeholder' do
         | 
| 13 15 | 
             
                  resolved = described_class.resolve(:test)
         | 
| 14 16 |  | 
| @@ -150,4 +152,19 @@ describe Turnip::Placeholder do | |
| 150 152 | 
             
                  end
         | 
| 151 153 | 
             
                end
         | 
| 152 154 | 
             
              end
         | 
| 155 | 
            +
             | 
| 156 | 
            +
              describe 'replacing placeholders' do
         | 
| 157 | 
            +
                before do
         | 
| 158 | 
            +
                  described_class.add(:test) do
         | 
| 159 | 
            +
                    match(/foo/)
         | 
| 160 | 
            +
                  end
         | 
| 161 | 
            +
                end
         | 
| 162 | 
            +
             | 
| 163 | 
            +
                it 'issues a warning' do
         | 
| 164 | 
            +
                  expect(described_class).to receive(:warn).with(/Placeholder :test was replaced/)
         | 
| 165 | 
            +
                  described_class.add(:test) do
         | 
| 166 | 
            +
                    match(/bar/)
         | 
| 167 | 
            +
                  end
         | 
| 168 | 
            +
                end
         | 
| 169 | 
            +
              end
         | 
| 153 170 | 
             
            end
         | 
    
        data/turnip.gemspec
    CHANGED
    
    | @@ -13,15 +13,13 @@ Gem::Specification.new do |s| | |
| 13 13 | 
             
              s.summary     = %q{Gherkin extension for RSpec}
         | 
| 14 14 | 
             
              s.description = %q{Provides the ability to define steps and run Gherkin files from with RSpec}
         | 
| 15 15 |  | 
| 16 | 
            -
              s.rubyforge_project = "turnip"
         | 
| 17 | 
            -
             | 
| 18 16 | 
             
              s.files         = `git ls-files`.split("\n")
         | 
| 19 17 | 
             
              s.test_files    = `git ls-files -- {test,spec,features}/*`.split("\n")
         | 
| 20 18 | 
             
              s.executables   = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
         | 
| 21 19 | 
             
              s.require_paths = ["lib"]
         | 
| 22 20 |  | 
| 23 21 | 
             
              s.add_runtime_dependency "rspec", [">=3.0", "<4.0"]
         | 
| 24 | 
            -
              s.add_runtime_dependency "gherkin", "~>  | 
| 22 | 
            +
              s.add_runtime_dependency "cucumber-gherkin", "~> 10.0"
         | 
| 25 23 | 
             
              s.add_development_dependency "rake"
         | 
| 26 24 | 
             
              s.add_development_dependency "pry"
         | 
| 27 25 | 
             
              s.add_development_dependency "pry-byebug"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: turnip
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 4.0 | 
| 4 | 
            +
              version: 4.1.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Jonas Nicklas
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2020-03-02 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rspec
         | 
| @@ -31,19 +31,19 @@ dependencies: | |
| 31 31 | 
             
                  - !ruby/object:Gem::Version
         | 
| 32 32 | 
             
                    version: '4.0'
         | 
| 33 33 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 34 | 
            -
              name: gherkin
         | 
| 34 | 
            +
              name: cucumber-gherkin
         | 
| 35 35 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 36 36 | 
             
                requirements:
         | 
| 37 37 | 
             
                - - "~>"
         | 
| 38 38 | 
             
                  - !ruby/object:Gem::Version
         | 
| 39 | 
            -
                    version:  | 
| 39 | 
            +
                    version: '10.0'
         | 
| 40 40 | 
             
              type: :runtime
         | 
| 41 41 | 
             
              prerelease: false
         | 
| 42 42 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 43 43 | 
             
                requirements:
         | 
| 44 44 | 
             
                - - "~>"
         | 
| 45 45 | 
             
                  - !ruby/object:Gem::Version
         | 
| 46 | 
            -
                    version:  | 
| 46 | 
            +
                    version: '10.0'
         | 
| 47 47 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 48 48 | 
             
              name: rake
         | 
| 49 49 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -182,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 182 182 | 
             
                - !ruby/object:Gem::Version
         | 
| 183 183 | 
             
                  version: '0'
         | 
| 184 184 | 
             
            requirements: []
         | 
| 185 | 
            -
             | 
| 186 | 
            -
            rubygems_version: 2.7.3
         | 
| 185 | 
            +
            rubygems_version: 3.0.3
         | 
| 187 186 | 
             
            signing_key: 
         | 
| 188 187 | 
             
            specification_version: 4
         | 
| 189 188 | 
             
            summary: Gherkin extension for RSpec
         |