gherkin 2.2.8-java → 2.2.9-java
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/README.rdoc +0 -1
- data/VERSION +1 -1
- data/cucumber.yml +1 -1
- data/features/step_definitions/json_parser_steps.rb +2 -0
- data/features/step_definitions/pretty_formatter_steps.rb +6 -4
- data/features/support/env.rb +1 -0
- data/java/.gitignore +3 -0
- data/lib/gherkin/formatter/argument.rb +4 -17
- data/lib/gherkin/formatter/colors.rb +4 -7
- data/lib/gherkin/formatter/model.rb +8 -0
- data/lib/gherkin/formatter/pretty_formatter.rb +60 -17
- data/lib/gherkin/formatter/step_printer.rb +17 -0
- data/lib/gherkin/i18n.rb +2 -2
- data/spec/gherkin/formatter/colors_spec.rb +1 -1
- data/spec/gherkin/formatter/filter_formatter_spec.rb +2 -0
- data/spec/gherkin/formatter/pretty_formatter_spec.rb +34 -27
- data/spec/gherkin/formatter/step_printer_spec.rb +55 -0
- data/spec/gherkin/java_libs.rb +13 -0
- data/spec/gherkin/output_stream_string_io.rb +4 -8
- data/spec/spec_helper.rb +1 -0
- metadata +9 -7
- data/lib/gherkin/formatter/monochrome_format.rb +0 -9
- data/spec/gherkin/formatter/argument_spec.rb +0 -28
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 2.2.9 (2010-10-15)
|
2
|
+
|
3
|
+
=== New Features
|
4
|
+
* PrettyFormatter can format features both with and without ANSI Colors. Using Jansi on Java. (Aslak Hellesøy)
|
5
|
+
* Extended Java Formatter API with a steps(List<Step>) method for better reporting in Java (Aslak Hellesøy)
|
6
|
+
|
1
7
|
== 2.2.8 (2010-10-04)
|
2
8
|
|
3
9
|
=== Removed Features
|
data/README.rdoc
CHANGED
@@ -9,7 +9,6 @@ Fast Gherkin lexer and parser based on Ragel. Gherkin is two things:
|
|
9
9
|
|
10
10
|
You'll need MRI (any version) if you want to build for MRI. To build the Java implementation you'll need JRuby.
|
11
11
|
You'll also need Ragel installed and on your PATH.
|
12
|
-
Finally you'll need the jeweler gem. (Jeweler will tell you what other gems you need when you run rake)
|
13
12
|
|
14
13
|
=== MRI
|
15
14
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.2.
|
1
|
+
2.2.9
|
data/cucumber.yml
CHANGED
@@ -6,9 +6,11 @@ require 'gherkin/formatter/json_formatter'
|
|
6
6
|
require 'gherkin/json_parser'
|
7
7
|
|
8
8
|
module PrettyPlease
|
9
|
+
include Gherkin::Formatter::Colors
|
10
|
+
|
9
11
|
def pretty_machinery(gherkin, feature_path)
|
10
12
|
io = StringIO.new
|
11
|
-
formatter = Gherkin::Formatter::PrettyFormatter.new(io,
|
13
|
+
formatter = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
12
14
|
parser = Gherkin::Parser::Parser.new(formatter, true)
|
13
15
|
parse(parser, gherkin, feature_path)
|
14
16
|
io.string
|
@@ -20,12 +22,12 @@ module PrettyPlease
|
|
20
22
|
gherkin_parser = Gherkin::Parser::Parser.new(json_formatter, true)
|
21
23
|
parse(gherkin_parser, gherkin, feature_path)
|
22
24
|
|
23
|
-
|
24
|
-
pretty_formatter = Gherkin::Formatter::PrettyFormatter.new(
|
25
|
+
io = StringIO.new
|
26
|
+
pretty_formatter = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
25
27
|
json_parser = Gherkin::JSONParser.new(pretty_formatter)
|
26
28
|
json_parser.parse(json.string, "#{feature_path}.json", 0)
|
27
29
|
|
28
|
-
|
30
|
+
io.string
|
29
31
|
end
|
30
32
|
|
31
33
|
def parse(parser, gherkin, feature_path)
|
data/features/support/env.rb
CHANGED
@@ -4,24 +4,11 @@ module Gherkin
|
|
4
4
|
module Formatter
|
5
5
|
class Argument
|
6
6
|
native_impl('gherkin')
|
7
|
-
attr_reader :
|
7
|
+
attr_reader :offset, :val
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
def self.format(string, argument_format, arguments)
|
14
|
-
arguments ||= []
|
15
|
-
s = string.dup
|
16
|
-
offset = past_offset = 0
|
17
|
-
arguments.each do |arg|
|
18
|
-
next if arg.byte_offset.nil? || arg.byte_offset < past_offset
|
19
|
-
replacement = argument_format.format_argument(arg.val)
|
20
|
-
s[arg.byte_offset + offset, arg.val.length] = replacement
|
21
|
-
offset += replacement.unpack("U*").length - arg.val.unpack("U*").length
|
22
|
-
past_offset = arg.byte_offset + arg.val.length
|
23
|
-
end
|
24
|
-
s
|
9
|
+
# Creates a new Argument that starts at character offset +offset+ with value +val+
|
10
|
+
def initialize(offset, val)
|
11
|
+
@offset, @val = offset, val
|
25
12
|
end
|
26
13
|
end
|
27
14
|
end
|
@@ -65,14 +65,11 @@ module Gherkin
|
|
65
65
|
ALIASES.each do |method, color|
|
66
66
|
unless method =~ /.*_param/
|
67
67
|
code = <<-EOF
|
68
|
-
def #{method}(string=nil,
|
69
|
-
return string if monochrome
|
68
|
+
def #{method}(string=nil, &proc)
|
70
69
|
#{ALIASES[method].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method].split(",").length}
|
71
70
|
end
|
72
|
-
#
|
73
|
-
|
74
|
-
return string if monochrome
|
75
|
-
#{ALIASES[method+'_param'].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method+'_param'].split(",").length} + #{ALIASES[method].split(",").join(' + ')}
|
71
|
+
def #{method}_param(string=nil, &proc)
|
72
|
+
#{ALIASES[method+'_param'].split(",").join("(") + "(string, &proc" + ")" * ALIASES[method+'_param'].split(",").length}
|
76
73
|
end
|
77
74
|
EOF
|
78
75
|
eval(code)
|
@@ -112,7 +109,7 @@ module Gherkin
|
|
112
109
|
"\e[90m#{m}\e[0m"
|
113
110
|
end
|
114
111
|
end
|
115
|
-
|
112
|
+
|
116
113
|
define_grey
|
117
114
|
end
|
118
115
|
end
|
@@ -150,6 +150,14 @@ module Gherkin
|
|
150
150
|
formatter.step(self)
|
151
151
|
end
|
152
152
|
|
153
|
+
def status
|
154
|
+
result ? result.status : 'undefined'
|
155
|
+
end
|
156
|
+
|
157
|
+
def arguments
|
158
|
+
result ? result.arguments : []
|
159
|
+
end
|
160
|
+
|
153
161
|
def to_hash
|
154
162
|
hash = super
|
155
163
|
if Array === @multiline_arg
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# encoding: utf-8
|
2
2
|
require 'gherkin/formatter/colors'
|
3
|
-
require 'gherkin/formatter/
|
3
|
+
require 'gherkin/formatter/step_printer'
|
4
4
|
require 'gherkin/formatter/argument'
|
5
5
|
require 'gherkin/formatter/escaping'
|
6
6
|
require 'gherkin/formatter/model'
|
@@ -14,10 +14,10 @@ module Gherkin
|
|
14
14
|
include Colors
|
15
15
|
include Escaping
|
16
16
|
|
17
|
-
def initialize(io, monochrome)
|
17
|
+
def initialize(io, monochrome=false)
|
18
18
|
@io = io
|
19
|
+
@step_printer = StepPrinter.new
|
19
20
|
@monochrome = monochrome
|
20
|
-
@format = MonochromeFormat.new #@monochrome ? MonochromeFormat.new : AnsiColorFormat.new
|
21
21
|
end
|
22
22
|
|
23
23
|
def uri(uri)
|
@@ -60,13 +60,7 @@ module Gherkin
|
|
60
60
|
end
|
61
61
|
|
62
62
|
def step(step)
|
63
|
-
|
64
|
-
|
65
|
-
step_text = "#{step.keyword}#{step.name}"
|
66
|
-
step_text = self.__send__(step.result.status, step_text, @monochrome) if step.result
|
67
|
-
|
68
|
-
print_comments(step.comments, ' ')
|
69
|
-
@io.puts(" #{step_text}#{indented_step_location!(step.result ? step.result.stepdef_location : nil)}")
|
63
|
+
print_step(step)
|
70
64
|
case step.multiline_arg
|
71
65
|
when Model::PyString
|
72
66
|
py_string(step.multiline_arg)
|
@@ -75,13 +69,62 @@ module Gherkin
|
|
75
69
|
end
|
76
70
|
end
|
77
71
|
|
72
|
+
def print_step(step)
|
73
|
+
print_comments(step.comments, ' ')
|
74
|
+
@io.write(' ')
|
75
|
+
text_format(step).write_text(@io, step.keyword)
|
76
|
+
@step_printer.write_step(@io, text_format(step), arg_format(step), step.name, step.arguments)
|
77
|
+
print_indented_stepdef_location!(step.result.stepdef_location) if step.result
|
78
|
+
# TODO: Print error message
|
79
|
+
@io.puts
|
80
|
+
end
|
81
|
+
|
82
|
+
class MonochromeFormat
|
83
|
+
def write_text(io, text)
|
84
|
+
io.write(text)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
class ColorFormat
|
89
|
+
include Colors
|
90
|
+
|
91
|
+
def initialize(status)
|
92
|
+
@status = status
|
93
|
+
end
|
94
|
+
|
95
|
+
def write_text(io, text)
|
96
|
+
io.write(self.__send__(@status, text))
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def text_format(step)
|
101
|
+
format(step.status)
|
102
|
+
end
|
103
|
+
|
104
|
+
def arg_format(step)
|
105
|
+
format(step.status + '_param')
|
106
|
+
end
|
107
|
+
|
108
|
+
def format(key)
|
109
|
+
if @formats.nil?
|
110
|
+
if @monochrome
|
111
|
+
@formats = Hash.new(MonochromeFormat.new)
|
112
|
+
else
|
113
|
+
@formats = Hash.new do |formats, status|
|
114
|
+
formats[status] = ColorFormat.new(status)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
@formats[key]
|
119
|
+
end
|
120
|
+
|
78
121
|
def eof
|
79
122
|
# NO-OP
|
80
123
|
end
|
81
124
|
|
82
125
|
# This method can be invoked before a #scenario, to ensure location arguments are aligned
|
83
126
|
def steps(steps)
|
84
|
-
@step_lengths = steps.map {|
|
127
|
+
@step_lengths = steps.map {|step| (step.keyword+step.name).unpack("U*").length}
|
85
128
|
@max_step_length = @step_lengths.max
|
86
129
|
@step_index = -1
|
87
130
|
end
|
@@ -114,12 +157,12 @@ module Gherkin
|
|
114
157
|
|
115
158
|
def exception(exception)
|
116
159
|
exception_text = "#{exception.message} (#{exception.class})\n#{(exception.backtrace || []).join("\n")}".gsub(/^/, ' ')
|
117
|
-
@io.puts(failed(exception_text
|
160
|
+
@io.puts(failed(exception_text))
|
118
161
|
end
|
119
162
|
|
120
163
|
def color(cell, statuses, col)
|
121
164
|
if statuses
|
122
|
-
self.__send__(statuses[col], escape_cell(cell)
|
165
|
+
self.__send__(statuses[col], escape_cell(cell)) + reset
|
123
166
|
else
|
124
167
|
escape_cell(cell)
|
125
168
|
end
|
@@ -161,13 +204,13 @@ module Gherkin
|
|
161
204
|
l = (keyword+name).unpack("U*").length
|
162
205
|
@max_step_length = [@max_step_length, l].max
|
163
206
|
indent = @max_step_length - l
|
164
|
-
' ' * indent + ' ' + comments("# #{@uri}:#{line}"
|
207
|
+
' ' * indent + ' ' + comments("# #{@uri}:#{line}")
|
165
208
|
end
|
166
209
|
|
167
|
-
def
|
168
|
-
return '' if location.nil?
|
210
|
+
def print_indented_stepdef_location!(location)
|
169
211
|
indent = @max_step_length - @step_lengths[@step_index+=1]
|
170
|
-
|
212
|
+
return if location.nil?
|
213
|
+
@io.write(' ' * indent + ' ' + comments("# #{location}"))
|
171
214
|
end
|
172
215
|
end
|
173
216
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Gherkin
|
2
|
+
module Formatter
|
3
|
+
class StepPrinter
|
4
|
+
def write_step(io, text_format, arg_format, step_name, arguments)
|
5
|
+
unpacked_step_name = step_name.unpack("U*")
|
6
|
+
|
7
|
+
text_start = 0
|
8
|
+
arguments.each do |arg|
|
9
|
+
text_format.write_text(io, unpacked_step_name[text_start..arg.offset-1].pack("U*")) unless arg.offset == 0
|
10
|
+
arg_format.write_text(io, arg.val)
|
11
|
+
text_start = arg.offset + arg.val.unpack("U*").length
|
12
|
+
end
|
13
|
+
text_format.write_text(io, unpacked_step_name[text_start..-1].pack("U*")) unless text_start == unpacked_step_name.length
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/gherkin/i18n.rb
CHANGED
@@ -57,7 +57,7 @@ module Gherkin
|
|
57
57
|
require 'gherkin/formatter/pretty_formatter'
|
58
58
|
require 'gherkin/formatter/model'
|
59
59
|
io = defined?(JRUBY_VERSION) ? Java.java.io.StringWriter.new : StringIO.new
|
60
|
-
pf = Gherkin::Formatter::PrettyFormatter.new(io
|
60
|
+
pf = Gherkin::Formatter::PrettyFormatter.new(io)
|
61
61
|
table = all.map do |i18n|
|
62
62
|
Formatter::Model::Row.new([], [i18n.iso_code, i18n.keywords('name')[0], i18n.keywords('native')[0]], nil)
|
63
63
|
end
|
@@ -149,7 +149,7 @@ module Gherkin
|
|
149
149
|
require 'gherkin/formatter/pretty_formatter'
|
150
150
|
require 'gherkin/formatter/model'
|
151
151
|
io = StringIO.new
|
152
|
-
pf = Gherkin::Formatter::PrettyFormatter.new(io
|
152
|
+
pf = Gherkin::Formatter::PrettyFormatter.new(io)
|
153
153
|
|
154
154
|
gherkin_keyword_table = KEYWORD_KEYS.map do |key|
|
155
155
|
Formatter::Model::Row.new([], [key, keywords(key).map{|keyword| %{"#{keyword}"}}.join(', ')], nil)
|
@@ -9,19 +9,22 @@ require 'stringio'
|
|
9
9
|
module Gherkin
|
10
10
|
module Formatter
|
11
11
|
describe PrettyFormatter do
|
12
|
+
include Colors
|
13
|
+
|
12
14
|
def assert_io(s)
|
13
15
|
actual = @io.string
|
16
|
+
actual.gsub!(/\e\[m/, "\e[0m") # JANSI resets without the 0.
|
14
17
|
actual.should == s
|
15
18
|
end
|
16
19
|
|
17
|
-
def assert_pretty(input,
|
20
|
+
def assert_pretty(input, expected_output=input)
|
18
21
|
[true, false].each do |force_ruby|
|
19
22
|
io = StringIO.new
|
20
23
|
pf = Gherkin::Formatter::PrettyFormatter.new(io, true)
|
21
24
|
parser = Gherkin::Parser::Parser.new(pf, true, "root", force_ruby)
|
22
25
|
parser.parse(input, "test.feature", 0)
|
23
|
-
|
24
|
-
|
26
|
+
output = io.string
|
27
|
+
output.should == expected_output
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
@@ -31,50 +34,54 @@ module Gherkin
|
|
31
34
|
|
32
35
|
before do
|
33
36
|
@io = StringIO.new
|
34
|
-
@
|
37
|
+
@colf = Gherkin::Formatter::PrettyFormatter.new(@io, false)
|
35
38
|
end
|
36
39
|
|
37
40
|
it "should print comments when scenario is longer" do
|
38
|
-
@
|
39
|
-
@
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
])
|
44
|
-
@
|
45
|
-
@
|
46
|
-
@l.step(Model::Step.new([], "When ", "foo", 6, nil, result('passed', nil, nil, "features/step_definitions/bar.rb:96")))
|
41
|
+
@colf.uri("features/foo.feature")
|
42
|
+
@colf.feature(Model::Feature.new([], [], "Feature", "Hello", "World", 1))
|
43
|
+
step1 = Model::Step.new([], "Given ", "some stuff", 5, nil, result('passed', nil, [], "features/step_definitions/bar.rb:56"))
|
44
|
+
step2 = Model::Step.new([], "When ", "foo", 6, nil, result('passed', nil, [], "features/step_definitions/bar.rb:96"))
|
45
|
+
@colf.steps([step1, step2])
|
46
|
+
@colf.scenario(Model::Scenario.new([], [], "Scenario", "The scenario", "", 4))
|
47
|
+
@colf.step(step1)
|
48
|
+
@colf.step(step2)
|
47
49
|
|
48
50
|
assert_io(%{Feature: Hello
|
49
51
|
World
|
50
52
|
|
51
|
-
Scenario: The scenario # features/foo.feature:4
|
52
|
-
Given some stuff # features/step_definitions/bar.rb:56
|
53
|
-
When foo # features/step_definitions/bar.rb:96
|
53
|
+
Scenario: The scenario #{grey('# features/foo.feature:4')}
|
54
|
+
#{green('Given ')}#{green('some stuff')} #{grey('# features/step_definitions/bar.rb:56')}
|
55
|
+
#{green('When ')}#{green('foo')} #{grey('# features/step_definitions/bar.rb:96')}
|
54
56
|
})
|
55
57
|
end
|
56
58
|
|
57
59
|
it "should print comments when step is longer" do
|
58
|
-
@
|
59
|
-
@
|
60
|
-
|
61
|
-
|
62
|
-
])
|
63
|
-
@
|
64
|
-
@l.step(Model::Step.new([], "Given ", "some stuff that is longer", 5, nil, result('passed', nil, nil, "features/step_definitions/bar.rb:56")))
|
60
|
+
@colf.uri("features/foo.feature")
|
61
|
+
@colf.feature(Model::Feature.new([], [], "Feature", "Hello", "World", 1))
|
62
|
+
step = Model::Step.new([], "Given ", "some stuff that is longer", 5, nil, result('passed', nil, [], "features/step_definitions/bar.rb:56"))
|
63
|
+
@colf.steps([step])
|
64
|
+
@colf.scenario(Model::Scenario.new([], [], "Scenario", "The scenario", "", 4))
|
65
|
+
@colf.step(step)
|
65
66
|
|
66
67
|
assert_io(%{Feature: Hello
|
67
68
|
World
|
68
69
|
|
69
|
-
Scenario: The scenario # features/foo.feature:4
|
70
|
-
Given some stuff that is longer # features/step_definitions/bar.rb:56
|
70
|
+
Scenario: The scenario #{grey('# features/foo.feature:4')}
|
71
|
+
#{green('Given ')}#{green('some stuff that is longer')} #{grey('# features/step_definitions/bar.rb:56')}
|
71
72
|
})
|
72
73
|
end
|
73
74
|
|
74
75
|
it "should highlight arguments for regular steps" do
|
75
76
|
step = Model::Step.new([], "Given ", "I have 999 cukes in my belly", 3, nil, result('passed', nil, [Gherkin::Formatter::Argument.new(7, '999')], nil))
|
76
|
-
@
|
77
|
-
|
77
|
+
@colf.steps([step])
|
78
|
+
@colf.step(step)
|
79
|
+
if defined?(JRUBY_VERSION)
|
80
|
+
# Not terribly readable. The result on Java is different because JANSI uses semicolons when there are several codes.
|
81
|
+
assert_io(" \e[32mGiven \e[0m\e[32mI have \e[0m\e[32;1m999\e[0m\e[32m cukes in my belly\e[0m\n")
|
82
|
+
else
|
83
|
+
assert_io(" #{green('Given ')}#{green('I have ')}#{green(bold('999'))}#{green(' cukes in my belly')}\n")
|
84
|
+
end
|
78
85
|
end
|
79
86
|
|
80
87
|
it "should prettify scenario" do
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
require 'gherkin/formatter/step_printer'
|
4
|
+
require 'gherkin/formatter/argument'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
module Gherkin
|
8
|
+
module Formatter
|
9
|
+
class ParenthesisFormat
|
10
|
+
def write_text(io, text)
|
11
|
+
io.write("(#{text})")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
class BracketFormat
|
16
|
+
def write_text(io, text)
|
17
|
+
io.write("[#{text}]")
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe StepPrinter do
|
22
|
+
before do
|
23
|
+
@io = StringIO.new
|
24
|
+
@p = StepPrinter.new
|
25
|
+
@pf = ParenthesisFormat.new
|
26
|
+
@bf = BracketFormat.new
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should replace 0 args" do
|
30
|
+
@p.write_step(@io, @pf, @bf, "I have 10 cukes", [])
|
31
|
+
@io.string.should == "(I have 10 cukes)"
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should replace 1 arg" do
|
35
|
+
@p.write_step(@io, @pf, @bf, "I have 10 cukes", [Argument.new(7, '10')])
|
36
|
+
@io.string.should == "(I have )[10]( cukes)"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should replace 1 unicode arg" do
|
40
|
+
@p.write_step(@io, @pf, @bf, "I hæve øæ cåkes", [Argument.new(7, 'øæ')])
|
41
|
+
@io.string.should == "(I hæve )[øæ]( cåkes)"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should replace 2 args" do
|
45
|
+
@p.write_step(@io, @pf, @bf, "I have 10 yellow cukes in my belly", [Argument.new(7, '10'), Argument.new(17, 'cukes')])
|
46
|
+
@io.string.should == "(I have )[10]( yellow )[cukes]( in my belly)"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should replace 2 unicode args" do
|
50
|
+
@p.write_step(@io, @pf, @bf, "Æslåk likes æøå", [Argument.new(0, 'Æslåk'), Argument.new(12, 'æøå')])
|
51
|
+
@io.string.should == "[Æslåk]( likes )[æøå]"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
if defined?(JRUBY_VERSION)
|
2
|
+
require 'rexml/document'
|
3
|
+
pom = REXML::Document.new(IO.read(File.dirname(__FILE__) + '/../../java/pom.xml'))
|
4
|
+
pom_version = REXML::XPath.first(pom, '//xmlns:project/xmlns:version/text()').to_s
|
5
|
+
REXML::XPath.each(pom, '//xmlns:project/xmlns:dependencies/xmlns:dependency').each do |dep|
|
6
|
+
groupId = dep.get_elements('groupId')[0].text()
|
7
|
+
artifactId = dep.get_elements('artifactId')[0].text()
|
8
|
+
version = dep.get_elements('version')[0].text()
|
9
|
+
|
10
|
+
jar = "~/.m2/repository/#{groupId.gsub(/\./, '/')}/#{artifactId}/#{version}/#{artifactId}-#{version}.jar"
|
11
|
+
require jar
|
12
|
+
end
|
13
|
+
end
|
@@ -1,15 +1,11 @@
|
|
1
1
|
if defined?(JRUBY_VERSION)
|
2
|
-
class
|
2
|
+
class WriterStringIO < Java.java.io.StringWriter
|
3
3
|
def write(what)
|
4
|
-
|
5
|
-
super(Java.java.lang.String.new(what).getBytes("UTF-8"))
|
6
|
-
else
|
7
|
-
super(what)
|
8
|
-
end
|
4
|
+
super(Java.java.lang.String.new(what.to_s))
|
9
5
|
end
|
10
6
|
|
11
7
|
def string
|
12
|
-
toString(
|
8
|
+
toString()
|
13
9
|
end
|
14
10
|
end
|
15
11
|
|
@@ -17,7 +13,7 @@ if defined?(JRUBY_VERSION)
|
|
17
13
|
class StringIO
|
18
14
|
class << self
|
19
15
|
def new
|
20
|
-
|
16
|
+
WriterStringIO.new
|
21
17
|
end
|
22
18
|
end
|
23
19
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 2.2.
|
8
|
+
- 9
|
9
|
+
version: 2.2.9
|
10
10
|
platform: java
|
11
11
|
authors:
|
12
12
|
- Mike Sassak
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-10-
|
19
|
+
date: 2010-10-15 00:00:00 +02:00
|
20
20
|
default_executable: gherkin
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -164,9 +164,9 @@ files:
|
|
164
164
|
- lib/gherkin/formatter/json_formatter.rb
|
165
165
|
- lib/gherkin/formatter/line_filter.rb
|
166
166
|
- lib/gherkin/formatter/model.rb
|
167
|
-
- lib/gherkin/formatter/monochrome_format.rb
|
168
167
|
- lib/gherkin/formatter/pretty_formatter.rb
|
169
168
|
- lib/gherkin/formatter/regexp_filter.rb
|
169
|
+
- lib/gherkin/formatter/step_printer.rb
|
170
170
|
- lib/gherkin/formatter/tag_count_formatter.rb
|
171
171
|
- lib/gherkin/formatter/tag_filter.rb
|
172
172
|
- lib/gherkin/i18n.rb
|
@@ -211,16 +211,17 @@ files:
|
|
211
211
|
- spec/gherkin/fixtures/simple_with_comments.feature
|
212
212
|
- spec/gherkin/fixtures/simple_with_tags.feature
|
213
213
|
- spec/gherkin/fixtures/with_bom.feature
|
214
|
-
- spec/gherkin/formatter/argument_spec.rb
|
215
214
|
- spec/gherkin/formatter/colors_spec.rb
|
216
215
|
- spec/gherkin/formatter/filter_formatter_spec.rb
|
217
216
|
- spec/gherkin/formatter/model_spec.rb
|
218
217
|
- spec/gherkin/formatter/pretty_formatter_spec.rb
|
219
218
|
- spec/gherkin/formatter/spaces.feature
|
219
|
+
- spec/gherkin/formatter/step_printer_spec.rb
|
220
220
|
- spec/gherkin/formatter/tabs.feature
|
221
221
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
222
222
|
- spec/gherkin/i18n_spec.rb
|
223
223
|
- spec/gherkin/java_lexer_spec.rb
|
224
|
+
- spec/gherkin/java_libs.rb
|
224
225
|
- spec/gherkin/json.rb
|
225
226
|
- spec/gherkin/json_parser_spec.rb
|
226
227
|
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
@@ -278,7 +279,7 @@ rubyforge_project:
|
|
278
279
|
rubygems_version: 1.3.7
|
279
280
|
signing_key:
|
280
281
|
specification_version: 3
|
281
|
-
summary: gherkin-2.2.
|
282
|
+
summary: gherkin-2.2.9
|
282
283
|
test_files:
|
283
284
|
- features/escaped_pipes.feature
|
284
285
|
- features/feature_parser.feature
|
@@ -311,16 +312,17 @@ test_files:
|
|
311
312
|
- spec/gherkin/fixtures/simple_with_comments.feature
|
312
313
|
- spec/gherkin/fixtures/simple_with_tags.feature
|
313
314
|
- spec/gherkin/fixtures/with_bom.feature
|
314
|
-
- spec/gherkin/formatter/argument_spec.rb
|
315
315
|
- spec/gherkin/formatter/colors_spec.rb
|
316
316
|
- spec/gherkin/formatter/filter_formatter_spec.rb
|
317
317
|
- spec/gherkin/formatter/model_spec.rb
|
318
318
|
- spec/gherkin/formatter/pretty_formatter_spec.rb
|
319
319
|
- spec/gherkin/formatter/spaces.feature
|
320
|
+
- spec/gherkin/formatter/step_printer_spec.rb
|
320
321
|
- spec/gherkin/formatter/tabs.feature
|
321
322
|
- spec/gherkin/formatter/tag_count_formatter_spec.rb
|
322
323
|
- spec/gherkin/i18n_spec.rb
|
323
324
|
- spec/gherkin/java_lexer_spec.rb
|
325
|
+
- spec/gherkin/java_libs.rb
|
324
326
|
- spec/gherkin/json.rb
|
325
327
|
- spec/gherkin/json_parser_spec.rb
|
326
328
|
- spec/gherkin/lexer/i18n_lexer_spec.rb
|
@@ -1,28 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'spec_helper'
|
3
|
-
require 'gherkin/formatter/argument'
|
4
|
-
|
5
|
-
module Gherkin
|
6
|
-
module Formatter
|
7
|
-
class BracketFormat
|
8
|
-
class << self
|
9
|
-
def new
|
10
|
-
defined?(JRUBY_VERSION) ? ::Java::GherkinFormatter::ArgumentFormat.new("[", "]") : super
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def format_argument(s)
|
15
|
-
"[#{s}]"
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
describe Argument do
|
20
|
-
it "should replace one arg" do
|
21
|
-
argument_class = defined?(JRUBY_VERSION) ? ::Java::GherkinFormatter::Argument : Gherkin::Formatter::Argument
|
22
|
-
argument_class.format("I have 10 cukes", Gherkin::Formatter::BracketFormat.new, [Gherkin::Formatter::Argument.new(7, '10')]).should == "I have [10] cukes"
|
23
|
-
end
|
24
|
-
|
25
|
-
# TODO: Add this spec: http://github.com/alg/cucumber/commit/33188e9db51f59ced74c4861524d7b2e69454630
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|