cucumber-expressions 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f6a5e7781e7fc8b3421fef99969e3dd056eb092
4
- data.tar.gz: 859b7122cb233520996367499d6b823a6cab1cca
3
+ metadata.gz: 0b8ed8f5d21a95380e884f0c080d076e2e89d17f
4
+ data.tar.gz: 7682387d1c85962fb28b6c21683bb48157ef3b49
5
5
  SHA512:
6
- metadata.gz: ecbdff604192d24ac59d9cf86fa1eb6a7a92116dcac99c6d62213b7e32dd986cfec419d74de38db73565ebfd912f8ddf027251d384f8111f7196f6105b8f6faf
7
- data.tar.gz: 1fe832838198c8cc4e2ea48106a15b20fb36a8889c567ce74422b3ed9bd117ecdaafce84a7be5ceaea6e94dfa11ec7c74c31397aa4ae52e2b3bf4d5ac2c3b665
6
+ metadata.gz: a66f2c66cc3de2a570ac6cc317f54eb4988bc4d99185b8e9649cff3c26b85670cbea82754cf8ad4483f60351494de83890068e3f970e3c7fa870e83d0e23a709
7
+ data.tar.gz: c34c94c1760c2a8a264c338000a0473b0d557fffe253e6bf1793f0e006d106de1ab59f47b9e2ebed1a4565c05b4715c79fddc103e4e2b26156a8b761252e7051
@@ -1,20 +1,15 @@
1
- # manyrepo: cucumber/cucumber-expressions-ruby
2
1
  language: ruby
3
- sudo: false
4
2
 
5
3
  rvm:
6
- - 2.3.1
7
- - 2.2
8
- - 2.1
9
- - 2.0
10
- - jruby-9.1.2.0
11
-
12
- before_install:
13
- - gem update bundler
4
+ - 2.4.0
5
+ - 2.3.3
6
+ - 2.2.6
7
+ - jruby-9.1.7.0
14
8
 
15
9
  notifications:
16
- email:
17
- - cukes-devs@googlegroups.com
18
10
  webhooks:
19
- urls: # gitter
20
- - https://webhooks.gitter.im/e/dc010332f9d40fcc21c4
11
+ urls:
12
+ - https://webhooks.gitter.im/e/5373e574ed4e88026838
13
+ on_success: change
14
+ on_failure: always
15
+ on_start: never
@@ -1,7 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  Gem::Specification.new do |s|
3
3
  s.name = 'cucumber-expressions'
4
- s.version = '1.0.3'
4
+ s.version = '1.0.4'
5
5
  s.authors = ["Aslak Hellesøy"]
6
6
  s.description = 'Cucumber Expressions - a simpler alternative to Regular Expressions'
7
7
  s.summary = "cucumber-expressions-#{s.version}"
@@ -11,13 +11,12 @@ Gem::Specification.new do |s|
11
11
  s.license = "MIT"
12
12
  s.required_ruby_version = ">= 1.9.3"
13
13
 
14
- s.add_development_dependency 'bundler', '>= 1.12.5'
15
- s.add_development_dependency 'rake', '>= 10.5.0'
14
+ s.add_development_dependency 'bundler'
15
+ s.add_development_dependency 'rake', '~> 10.5'
16
16
  s.add_development_dependency 'rspec', '~> 3.5'
17
- s.add_development_dependency 'json', '~> 2.0.2'
18
17
 
19
18
  # For coverage reports
20
- s.add_development_dependency 'coveralls', '~> 0.7'
19
+ s.add_development_dependency 'coveralls'
21
20
 
22
21
  s.rubygems_version = ">= 1.6.1"
23
22
  s.files = `git ls-files`.split("\n").reject {|path| path =~ /\.gitignore$/ }
@@ -45,7 +45,7 @@ module Cucumber
45
45
  @transforms.push(transform)
46
46
 
47
47
  text = expression.slice(match_offset...match.offset(0)[0])
48
- capture_regexp = "(#{transform.capture_group_regexps[0]})"
48
+ capture_regexp = capture_group_regexp(transform.capture_group_regexps)
49
49
  match_offset = match.offset(0)[1]
50
50
  regexp += text
51
51
  regexp += capture_regexp
@@ -58,6 +58,14 @@ module Cucumber
58
58
  def match(text)
59
59
  ArgumentMatcher.match_arguments(@regexp, text, @transforms)
60
60
  end
61
+
62
+ private
63
+
64
+ def capture_group_regexp(capture_group_regexps)
65
+ return "(#{capture_group_regexps[0]})" if capture_group_regexps.size == 1
66
+ capture_groups = capture_group_regexps.map { |group| "(?:#{group})" }
67
+ "(#{capture_groups.join('|')})"
68
+ end
61
69
  end
62
70
  end
63
71
  end
@@ -7,10 +7,7 @@ module Cucumber
7
7
  #
8
8
  # @param type_name [Array] array of class or type name to use in {arg:type_name}
9
9
  # @param capture_group_regexps [Array] list of regexps for capture groups.
10
- # The first one is the primary one, used to convert CucumberExpression instances
11
- # to their internal Regexp representation. They are all used for type conversion
12
- # in RegularExpression instances.
13
- # @transformer lambda that transforms a String to another type
10
+ # @param transformer lambda that transforms a String to another type
14
11
  #
15
12
  def initialize(type_name, type, capture_group_regexps, transformer)
16
13
  @type_name, @type, @transformer = type_name, type, transformer
@@ -3,7 +3,7 @@ require 'cucumber/cucumber_expressions/transform'
3
3
  module Cucumber
4
4
  module CucumberExpressions
5
5
  class TransformLookup
6
- FIXNUM_REGEXPS = ['-?\d+', '\d+']
6
+ INTEGER_REGEXPS = ['-?\d+', '\d+']
7
7
  FLOATING_POINT_REGEXPS = ['-?\d*\.?\d+']
8
8
 
9
9
  def initialize
@@ -11,7 +11,7 @@ module Cucumber
11
11
  @transforms_by_capture_group_regexp = {}
12
12
  @transforms_by_class = {}
13
13
 
14
- add_transform(Transform.new('int', Fixnum, FIXNUM_REGEXPS, lambda {|s| s.to_i}))
14
+ add_transform(Transform.new('int', Integer, INTEGER_REGEXPS, lambda {|s| s.to_i}))
15
15
  add_transform(Transform.new('float', Float, FLOATING_POINT_REGEXPS, lambda {|s| s.to_f}))
16
16
  end
17
17
 
@@ -13,7 +13,7 @@ module CaptureWarnings
13
13
  end
14
14
 
15
15
  if other_warnings.any?
16
- puts "#{ other_warnings.count } non-cucumber-core warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
16
+ puts "#{ other_warnings.count } non-cucumber-expressions warnings detected, set VIEW_OTHER_WARNINGS=true to see them."
17
17
  print_warnings('other', other_warnings) if ENV['VIEW_OTHER_WARNINGS']
18
18
  end
19
19
 
@@ -23,9 +23,9 @@ module CaptureWarnings
23
23
  end
24
24
 
25
25
  if project_warnings.any?
26
- puts "#{ project_warnings.count } cucumber-core warnings detected"
27
- print_warnings('cucumber-core', project_warnings)
28
- fail "Please remove all cucumber-core warnings."
26
+ puts "#{ project_warnings.count } cucumber-expressions warnings detected"
27
+ print_warnings('cucumber-expressions', project_warnings)
28
+ fail "Please remove all cucumber-expressions warnings."
29
29
  end
30
30
 
31
31
  ensure_system_exit_if_required
@@ -63,7 +63,7 @@ module Cucumber
63
63
  it "exposes transforms in generated expression" do
64
64
  expression = @generator.generate_expression("I have 2 cukes and 1.5 euro", true)
65
65
  types = expression.transforms.map(&:type)
66
- expect(types).to eq([Fixnum, Float])
66
+ expect(types).to eq([Integer, Float])
67
67
  end
68
68
 
69
69
  def assert_typed_expression(expected, text)
@@ -27,7 +27,7 @@ module Cucumber
27
27
  it "translates three typed arguments" do
28
28
  assert_regexp(
29
29
  "I have {n:float} cukes in my {bodypart} at {time:int} o'clock",
30
- /^I have (-?\d*\.?\d+) cukes in my (.+) at (-?\d+) o'clock$/
30
+ /^I have (-?\d*\.?\d+) cukes in my (.+) at ((?:-?\d+)|(?:\d+)) o'clock$/
31
31
  )
32
32
  end
33
33
 
@@ -30,8 +30,8 @@ module Cucumber
30
30
  end
31
31
 
32
32
  # Ruby-specific
33
- it "transforms to Fixnum by explicit type" do
34
- expect( match("{what}", "22", [Fixnum]) ).to eq([22])
33
+ it "transforms to Integer by explicit type" do
34
+ expect( match("{what}", "22", [Integer]) ).to eq([22])
35
35
  end
36
36
 
37
37
  it "doesn't match a float to an int" do
@@ -13,7 +13,7 @@ module Cucumber
13
13
  end
14
14
  ### [color-constructor]
15
15
 
16
- def == (other)
16
+ def ==(other)
17
17
  other.is_a?(Color) && other.name == name
18
18
  end
19
19
  end
@@ -25,19 +25,25 @@ module Cucumber
25
25
  @transform_lookup.add_transform(Transform.new(
26
26
  'color',
27
27
  Color,
28
- 'red|blue|yellow',
28
+ ['red|blue|yellow', '(?:dark|light) (?:red|blue|yellow)'],
29
29
  lambda { |s| Color.new(s) }
30
30
  ))
31
31
  ### [add-color-transform]
32
32
  end
33
33
 
34
34
  describe CucumberExpression do
35
- it "transforms arguments with expression type" do
35
+ it "transforms arguments with expression type I" do
36
36
  expression = CucumberExpression.new("I have a {color:color} ball", [], @transform_lookup)
37
37
  transformed_argument_value = expression.match("I have a red ball")[0].transformed_value
38
38
  expect( transformed_argument_value ).to eq(Color.new('red'))
39
39
  end
40
40
 
41
+ it "transforms arguments with expression type II" do
42
+ expression = CucumberExpression.new("I have a {color:color} ball", [], @transform_lookup)
43
+ transformed_argument_value = expression.match("I have a dark red ball")[0].transformed_value
44
+ expect( transformed_argument_value ).to eq(Color.new('dark red'))
45
+ end
46
+
41
47
  it "transforms arguments with explicit type" do
42
48
  expression = CucumberExpression.new("I have a {color} ball", [Color], @transform_lookup)
43
49
  transformed_argument_value = expression.match("I have a red ball")[0].transformed_value
@@ -51,7 +51,8 @@ module Cucumber
51
51
 
52
52
  it "fails when type is not type name or class" do
53
53
  expect( lambda { match(/(.*)/, "-1.22", [99]) } ).to raise_error(
54
- 'Type must be string or class, but was 99 of type Fixnum')
54
+ # Ruby 2.3 and older report Fixnum, 2.4 and newer report Integer
55
+ /Type must be string or class, but was 99 of type (?:Fixnum)|(?:Integer)/)
55
56
  end
56
57
 
57
58
  it "exposes source" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber-expressions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aslak Hellesøy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-25 00:00:00.000000000 Z
11
+ date: 2017-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.12.5
19
+ version: '0'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.12.5
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 10.5.0
33
+ version: '10.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 10.5.0
40
+ version: '10.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,34 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.5'
55
- - !ruby/object:Gem::Dependency
56
- name: json
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: 2.0.2
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: 2.0.2
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: coveralls
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - "~>"
59
+ - - ">="
74
60
  - !ruby/object:Gem::Version
75
- version: '0.7'
61
+ version: '0'
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - "~>"
66
+ - - ">="
81
67
  - !ruby/object:Gem::Version
82
- version: '0.7'
68
+ version: '0'
83
69
  description: Cucumber Expressions - a simpler alternative to Regular Expressions
84
70
  email: cukes@googlegroups.com
85
71
  executables: []
@@ -133,10 +119,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
119
  version: '0'
134
120
  requirements: []
135
121
  rubyforge_project:
136
- rubygems_version: 2.5.2
122
+ rubygems_version: 2.4.5.2
137
123
  signing_key:
138
124
  specification_version: 4
139
- summary: cucumber-expressions-1.0.3
125
+ summary: cucumber-expressions-1.0.4
140
126
  test_files:
141
127
  - spec/capture_warnings.rb
142
128
  - spec/coverage.rb