cucumber_priority 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -6,3 +6,4 @@ pkg
6
6
  .rvmrc
7
7
  log/*.log
8
8
  .byebug_history
9
+ /tmp
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Runtime dependencies
4
+ gem 'cucumber', '~> 2.4.0'
5
+
6
+ # Development dependencies
7
+ gem 'rspec', '~> 3.0'
8
+ gem 'gemika'
9
+ gem 'rake'
10
+ gem 'aruba', '<0.7'
11
+
12
+ # Gem under test
13
+ gem 'cucumber_priority', :path => '..'
@@ -0,0 +1,61 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ cucumber_priority (0.3.2)
5
+ cucumber
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ aruba (0.6.2)
11
+ childprocess (>= 0.3.6)
12
+ cucumber (>= 1.1.1)
13
+ rspec-expectations (>= 2.7.0)
14
+ builder (3.2.3)
15
+ childprocess (0.9.0)
16
+ ffi (~> 1.0, >= 1.0.11)
17
+ cucumber (2.4.0)
18
+ builder (>= 2.1.2)
19
+ cucumber-core (~> 1.5.0)
20
+ cucumber-wire (~> 0.0.1)
21
+ diff-lcs (>= 1.1.3)
22
+ gherkin (~> 4.0)
23
+ multi_json (>= 1.7.5, < 2.0)
24
+ multi_test (>= 0.1.2)
25
+ cucumber-core (1.5.0)
26
+ gherkin (~> 4.0)
27
+ cucumber-wire (0.0.1)
28
+ diff-lcs (1.3)
29
+ ffi (1.9.23)
30
+ gemika (0.3.2)
31
+ gherkin (4.1.3)
32
+ multi_json (1.13.1)
33
+ multi_test (0.1.2)
34
+ rake (10.1.0)
35
+ rspec (3.4.0)
36
+ rspec-core (~> 3.4.0)
37
+ rspec-expectations (~> 3.4.0)
38
+ rspec-mocks (~> 3.4.0)
39
+ rspec-core (3.4.3)
40
+ rspec-support (~> 3.4.0)
41
+ rspec-expectations (3.4.0)
42
+ diff-lcs (>= 1.2.0, < 2.0)
43
+ rspec-support (~> 3.4.0)
44
+ rspec-mocks (3.4.1)
45
+ diff-lcs (>= 1.2.0, < 2.0)
46
+ rspec-support (~> 3.4.0)
47
+ rspec-support (3.4.1)
48
+
49
+ PLATFORMS
50
+ ruby
51
+
52
+ DEPENDENCIES
53
+ aruba (< 0.7)
54
+ cucumber (~> 2.4.0)
55
+ cucumber_priority!
56
+ gemika
57
+ rake
58
+ rspec (~> 3.0)
59
+
60
+ BUNDLED WITH
61
+ 1.16.1
@@ -12,9 +12,11 @@ Gem::Specification.new do |s|
12
12
  s.description = %q{cucumber_priority provides a way to mark step definitions as overridable, meaning that they can always be overshadowed by a more specific version without raising an error.}
13
13
  s.license = 'MIT'
14
14
 
15
- s.files = `git ls-files`.split("\n")
16
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
15
+ s.files = `git ls-files -z`.split("\x0").reject do |f|
16
+ f.match(%r{^(gemfiles|bin|test|spec|features)/})
17
+ end
18
+ s.bindir = "exe"
19
+ s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
20
  s.require_paths = ["lib"]
19
21
 
20
22
  s.add_dependency('cucumber')
@@ -44,13 +44,15 @@ if Cucumber::VERSION >= '3'
44
44
 
45
45
  elsif Cucumber::VERSION >= '2.3'
46
46
 
47
+
48
+ # Cucumber 2.3 or higher has methods that return an array of Cucumber::StepMatch objects.
49
+ # These methods raise Cucumber::Ambiguous if the array has more than one element.
50
+ # Why this is implemented twice, noone knows...
51
+ #
47
52
  module Cucumber
53
+
48
54
  class Runtime
49
55
  class SupportCode
50
-
51
- # Cucumber 2.3 or higher has a single method #step_matches which returns an
52
- # array of Cucumber::StepMatch objects.
53
- # This method raises Cucumber::Ambiguous if the array has more than one element.
54
56
  def step_matches_with_priority(*args)
55
57
  step_matches_without_priority(*args)
56
58
  rescue Ambiguous => e
@@ -60,6 +62,21 @@ elsif Cucumber::VERSION >= '2.3'
60
62
  CucumberPriority::Util.alias_chain self, :step_matches, :priority
61
63
  end
62
64
  end
65
+
66
+ module StepMatchSearch
67
+ class AssertUnambiguousMatch
68
+
69
+ def call_with_priority(*args)
70
+ call_without_priority(*args)
71
+ rescue Ambiguous => e
72
+ [CucumberPriority::Resolver.resolve_ambiguity_through_priority(e)]
73
+ end
74
+
75
+ CucumberPriority::Util.alias_chain self, :call, :priority
76
+
77
+ end
78
+ end
79
+
63
80
  end
64
81
 
65
82
  else
@@ -1,3 +1,3 @@
1
1
  module CucumberPriority
2
- VERSION = '0.3.1'
2
+ VERSION = '0.3.2'
3
3
  end
metadata CHANGED
@@ -1,27 +1,30 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_priority
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Henning Koch
8
9
  autorequire:
9
- bindir: bin
10
+ bindir: exe
10
11
  cert_chain: []
11
- date: 2018-02-28 00:00:00.000000000 Z
12
+ date: 2018-04-27 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: cucumber
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '0'
27
30
  description: cucumber_priority provides a way to mark step definitions as overridable,
@@ -32,24 +35,16 @@ executables: []
32
35
  extensions: []
33
36
  extra_rdoc_files: []
34
37
  files:
35
- - ".gitignore"
36
- - ".rspec"
37
- - ".ruby-version"
38
- - ".travis.yml"
38
+ - .gitignore
39
+ - .rspec
40
+ - .ruby-version
41
+ - .travis.yml
39
42
  - Gemfile
40
43
  - Gemfile.lock
41
44
  - LICENSE
42
45
  - README.md
43
46
  - Rakefile
44
47
  - cucumber_priority.gemspec
45
- - gemfiles/Gemfile.cucumber-1.3
46
- - gemfiles/Gemfile.cucumber-1.3.lock
47
- - gemfiles/Gemfile.cucumber-2.4
48
- - gemfiles/Gemfile.cucumber-2.4.lock
49
- - gemfiles/Gemfile.cucumber-3.0
50
- - gemfiles/Gemfile.cucumber-3.0.lock
51
- - gemfiles/Gemfile.cucumber-3.1
52
- - gemfiles/Gemfile.cucumber-3.1.lock
53
48
  - lib/cucumber_priority.rb
54
49
  - lib/cucumber_priority/ambiguous_error_ext.rb
55
50
  - lib/cucumber_priority/require_cucumber.rb
@@ -57,32 +52,29 @@ files:
57
52
  - lib/cucumber_priority/step_definition_ext.rb
58
53
  - lib/cucumber_priority/util.rb
59
54
  - lib/cucumber_priority/version.rb
60
- - spec/cucumber_priority/support_code_ext_spec.rb
61
- - spec/spec.opts
62
- - spec/spec_helper.rb
63
- - spec/support/cucumber_helper.rb
64
55
  homepage: http://github.com/makandra/cucumber_priority
65
56
  licenses:
66
57
  - MIT
67
- metadata: {}
68
58
  post_install_message:
69
59
  rdoc_options: []
70
60
  require_paths:
71
61
  - lib
72
62
  required_ruby_version: !ruby/object:Gem::Requirement
63
+ none: false
73
64
  requirements:
74
- - - ">="
65
+ - - ! '>='
75
66
  - !ruby/object:Gem::Version
76
67
  version: '0'
77
68
  required_rubygems_version: !ruby/object:Gem::Requirement
69
+ none: false
78
70
  requirements:
79
- - - ">="
71
+ - - ! '>='
80
72
  - !ruby/object:Gem::Version
81
73
  version: '0'
82
74
  requirements: []
83
75
  rubyforge_project:
84
- rubygems_version: 2.7.3
76
+ rubygems_version: 1.8.23
85
77
  signing_key:
86
- specification_version: 4
78
+ specification_version: 3
87
79
  summary: Overridable step definitions for Cucumber
88
80
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA256:
3
- metadata.gz: a079b181ab4eaea2b39c27db2fda7c8f299821de5f56bfcb49207e3f77fd32a1
4
- data.tar.gz: 7f32402851987a27f43b15ab21bad90aa689de363ea0985fa177ceb2590d70ae
5
- SHA512:
6
- metadata.gz: 4c92ea01431f7327765bc948447d6418718156214982a058249974391634820e90d8d60a59adb06347f6023c074fa3d53c35206c934fe16866ea1ca8426047fe
7
- data.tar.gz: 21330e0c5712f14db7e4a63c5768580e26c12522abc9b27418014982f1a439a45ceac16e08ff749bc38e567efd7700ac29634add935c46e64299ba1bd102e851
data/Gemfile DELETED
@@ -1 +0,0 @@
1
- ./gemfiles/Gemfile.cucumber-2.4
@@ -1 +0,0 @@
1
- ./gemfiles/Gemfile.cucumber-2.4.lock
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Runtime dependencies
4
- gem 'cucumber', '~> 1.3.20'
5
-
6
- # Development dependencies
7
- gem 'rspec', '~> 1.0'
8
- gem 'gemika'
9
- gem 'rake', '=10.0.4'
10
-
11
- # Gem under test
12
- gem 'cucumber_priority', :path => '..'
@@ -1,37 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- cucumber_priority (0.2.0)
5
- cucumber
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- builder (3.2.2)
11
- cucumber (1.3.20)
12
- builder (>= 2.1.2)
13
- diff-lcs (>= 1.1.3)
14
- gherkin (~> 2.12)
15
- multi_json (>= 1.7.5, < 2.0)
16
- multi_test (>= 0.1.2)
17
- diff-lcs (1.2.5)
18
- gemika (0.3.2)
19
- gherkin (2.12.2)
20
- multi_json (~> 1.3)
21
- multi_json (1.11.2)
22
- multi_test (0.1.2)
23
- rake (10.0.4)
24
- rspec (1.3.2)
25
-
26
- PLATFORMS
27
- ruby
28
-
29
- DEPENDENCIES
30
- cucumber (~> 1.3.20)
31
- cucumber_priority!
32
- gemika
33
- rake (= 10.0.4)
34
- rspec (~> 1.0)
35
-
36
- BUNDLED WITH
37
- 1.16.1
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Runtime dependencies
4
- gem 'cucumber', '~> 2.4.0'
5
-
6
- # Development dependencies
7
- gem 'rspec', '~> 3.0'
8
- gem 'gemika'
9
- gem 'rake'
10
-
11
- # Gem under test
12
- gem 'cucumber_priority', :path => '..'
@@ -1,53 +0,0 @@
1
- PATH
2
- remote: ..
3
- specs:
4
- cucumber_priority (0.2.0)
5
- cucumber
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- builder (3.2.3)
11
- cucumber (2.4.0)
12
- builder (>= 2.1.2)
13
- cucumber-core (~> 1.5.0)
14
- cucumber-wire (~> 0.0.1)
15
- diff-lcs (>= 1.1.3)
16
- gherkin (~> 4.0)
17
- multi_json (>= 1.7.5, < 2.0)
18
- multi_test (>= 0.1.2)
19
- cucumber-core (1.5.0)
20
- gherkin (~> 4.0)
21
- cucumber-wire (0.0.1)
22
- diff-lcs (1.3)
23
- gemika (0.3.2)
24
- gherkin (4.1.3)
25
- multi_json (1.13.1)
26
- multi_test (0.1.2)
27
- rake (10.1.0)
28
- rspec (3.4.0)
29
- rspec-core (~> 3.4.0)
30
- rspec-expectations (~> 3.4.0)
31
- rspec-mocks (~> 3.4.0)
32
- rspec-core (3.4.3)
33
- rspec-support (~> 3.4.0)
34
- rspec-expectations (3.4.0)
35
- diff-lcs (>= 1.2.0, < 2.0)
36
- rspec-support (~> 3.4.0)
37
- rspec-mocks (3.4.1)
38
- diff-lcs (>= 1.2.0, < 2.0)
39
- rspec-support (~> 3.4.0)
40
- rspec-support (3.4.1)
41
-
42
- PLATFORMS
43
- ruby
44
-
45
- DEPENDENCIES
46
- cucumber (~> 2.4.0)
47
- cucumber_priority!
48
- gemika
49
- rake
50
- rspec (~> 3.0)
51
-
52
- BUNDLED WITH
53
- 1.16.1
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Runtime dependencies
4
- gem 'cucumber', '~> 3.0.0'
5
-
6
- # Development dependencies
7
- gem 'rspec', '~> 3.0'
8
- gem 'gemika'
9
- gem 'rake'
10
-
11
- # Gem under test
12
- gem 'cucumber_priority'
@@ -1,67 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (5.0.1)
5
- concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (~> 0.7)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- backports (3.11.1)
10
- builder (3.2.3)
11
- concurrent-ruby (1.0.3)
12
- cucumber (3.0.2)
13
- builder (>= 2.1.2)
14
- cucumber-core (~> 3.0.0)
15
- cucumber-expressions (~> 4.0.3)
16
- cucumber-wire (~> 0.0.1)
17
- diff-lcs (~> 1.3)
18
- gherkin (~> 4.0)
19
- multi_json (>= 1.7.5, < 2.0)
20
- multi_test (>= 0.1.2)
21
- cucumber-core (3.0.0)
22
- backports (>= 3.8.0)
23
- cucumber-tag_expressions (>= 1.0.1)
24
- gherkin (>= 4.1.3)
25
- cucumber-expressions (4.0.4)
26
- cucumber-tag_expressions (1.1.1)
27
- cucumber-wire (0.0.1)
28
- cucumber_priority (0.1.2)
29
- activesupport
30
- cucumber
31
- diff-lcs (1.3)
32
- gemika (0.3.2)
33
- gherkin (4.1.3)
34
- i18n (0.7.0)
35
- minitest (5.10.1)
36
- multi_json (1.13.1)
37
- multi_test (0.1.2)
38
- rake (10.4.2)
39
- rspec (3.5.0)
40
- rspec-core (~> 3.5.0)
41
- rspec-expectations (~> 3.5.0)
42
- rspec-mocks (~> 3.5.0)
43
- rspec-core (3.5.4)
44
- rspec-support (~> 3.5.0)
45
- rspec-expectations (3.5.0)
46
- diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.5.0)
48
- rspec-mocks (3.5.0)
49
- diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.5.0)
51
- rspec-support (3.5.0)
52
- thread_safe (0.3.5)
53
- tzinfo (1.2.2)
54
- thread_safe (~> 0.1)
55
-
56
- PLATFORMS
57
- ruby
58
-
59
- DEPENDENCIES
60
- cucumber (~> 3.0.0)
61
- cucumber_priority
62
- gemika
63
- rake
64
- rspec (~> 3.0)
65
-
66
- BUNDLED WITH
67
- 1.16.1
@@ -1,12 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Runtime dependencies
4
- gem 'cucumber', '~> 3.1.0'
5
-
6
- # Development dependencies
7
- gem 'rspec', '~> 3.0'
8
- gem 'gemika'
9
- gem 'rake'
10
-
11
- # Gem under test
12
- gem 'cucumber_priority'
@@ -1,67 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- activesupport (5.0.1)
5
- concurrent-ruby (~> 1.0, >= 1.0.2)
6
- i18n (~> 0.7)
7
- minitest (~> 5.1)
8
- tzinfo (~> 1.1)
9
- backports (3.11.1)
10
- builder (3.2.3)
11
- concurrent-ruby (1.0.3)
12
- cucumber (3.1.0)
13
- builder (>= 2.1.2)
14
- cucumber-core (~> 3.1.0)
15
- cucumber-expressions (~> 5.0.4)
16
- cucumber-wire (~> 0.0.1)
17
- diff-lcs (~> 1.3)
18
- gherkin (~> 5.0)
19
- multi_json (>= 1.7.5, < 2.0)
20
- multi_test (>= 0.1.2)
21
- cucumber-core (3.1.0)
22
- backports (>= 3.8.0)
23
- cucumber-tag_expressions (~> 1.1.0)
24
- gherkin (>= 5.0.0)
25
- cucumber-expressions (5.0.13)
26
- cucumber-tag_expressions (1.1.1)
27
- cucumber-wire (0.0.1)
28
- cucumber_priority (0.1.2)
29
- activesupport
30
- cucumber
31
- diff-lcs (1.3)
32
- gemika (0.3.2)
33
- gherkin (5.0.0)
34
- i18n (0.7.0)
35
- minitest (5.10.1)
36
- multi_json (1.13.1)
37
- multi_test (0.1.2)
38
- rake (10.4.2)
39
- rspec (3.5.0)
40
- rspec-core (~> 3.5.0)
41
- rspec-expectations (~> 3.5.0)
42
- rspec-mocks (~> 3.5.0)
43
- rspec-core (3.5.4)
44
- rspec-support (~> 3.5.0)
45
- rspec-expectations (3.5.0)
46
- diff-lcs (>= 1.2.0, < 2.0)
47
- rspec-support (~> 3.5.0)
48
- rspec-mocks (3.5.0)
49
- diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.5.0)
51
- rspec-support (3.5.0)
52
- thread_safe (0.3.5)
53
- tzinfo (1.2.2)
54
- thread_safe (~> 0.1)
55
-
56
- PLATFORMS
57
- ruby
58
-
59
- DEPENDENCIES
60
- cucumber (~> 3.1.0)
61
- cucumber_priority
62
- gemika
63
- rake
64
- rspec (~> 3.0)
65
-
66
- BUNDLED WITH
67
- 1.16.1
@@ -1,39 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Cucumber::Runtime, 'extended with cucumber_priority' do
4
-
5
- before(:each) do
6
- prepare_cucumber_example
7
- end
8
-
9
- describe '#step_matches' do
10
-
11
- it 'returns an overriding step if the only other match is a overridable step' do
12
- overridable_step = @main.Given(/^there is a movie with a (.*?) tone$/){ }.overridable
13
- overriding_step = @main.Given(/^there is a movie with a funny tone$/){ }
14
- match = first_step_match('there is a movie with a funny tone')
15
- match.step_definition.should == overriding_step
16
- match.should be_a(Cucumber::StepMatch)
17
- end
18
-
19
- it 'raises Cucumber::Ambiguous if more than two overriding steps match' do
20
- @main.Given(/^there is a movie with (.*?) tone$/){}.overridable(:priority => 1000)
21
- @main.Given(/^there is a movie with a [^ ]+ tone$/){}
22
- @main.Given(/^there is a movie with a funny tone$/){}
23
- expect do
24
- first_step_match('there is a movie with a funny tone')
25
- end.to raise_error(Cucumber::Ambiguous)
26
- end
27
-
28
- it 'returns the overridable step with the highest priority if no overriding steps match' do
29
- overridable_step = @main.Given(/^there is a movie with a (.*?) tone$/){ }.overridable
30
- higher_overridable_step = @main.Given(/^there is a movie with a [^ ]+ tone$/){ }.overridable(:priority => 5)
31
- lower_overridable_step = @main.Given(/^there is a movie with a [^ ]+ tone$/){ }.overridable(:priority => -5)
32
- match = first_step_match('there is a movie with a funny tone')
33
- match.step_definition.should == higher_overridable_step
34
- match.should be_a(Cucumber::StepMatch)
35
- end
36
-
37
- end
38
-
39
- end
@@ -1 +0,0 @@
1
- --colour
@@ -1,7 +0,0 @@
1
- $: << File.join(File.dirname(__FILE__), "/../../lib" )
2
- require 'cucumber_priority'
3
- require 'gemika'
4
-
5
- Dir["#{File.dirname(__FILE__)}/support/*.rb"].sort.each {|f| require f}
6
-
7
- Gemika::RSpec.configure_should_syntax
@@ -1,31 +0,0 @@
1
- def prepare_cucumber_example
2
- if Cucumber::VERSION >= '3'
3
- @runtime = Cucumber::Runtime.new
4
- scenario = double('scenario', :language => 'en', :accept_hook? => true)
5
- @runtime.send(:begin_scenario, scenario)
6
- @main = Object.new
7
- @main.extend(Cucumber::Glue::Dsl)
8
- else
9
- @runtime = Cucumber::Runtime.new
10
- language = support_code.ruby if support_code.respond_to?(:ruby)
11
- language ||= support_code.load_programming_language('rb')
12
- language
13
- scenario = double('scenario', :language => 'en', :accept_hook? => true)
14
- language.send(:begin_scenario, scenario)
15
- @world = language.current_world
16
- @main = Object.new
17
- @main.extend(Cucumber::RbSupport::RbDsl)
18
- end
19
- end
20
-
21
- def invoke_cucumber_step(step)
22
- first_step_match(step).invoke(nil) # nil means no multiline args
23
- end
24
-
25
- def support_code
26
- @runtime.instance_variable_get(:@support_code)
27
- end
28
-
29
- def first_step_match(*args)
30
- support_code.send(:step_matches, *args).first
31
- end