aslakhellesoy-cucumber 0.1.100.1 → 0.1.100.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +1 -0
- data/Manifest.txt +0 -1
- data/lib/cucumber/ast/table.rb +1 -1
- data/lib/cucumber/ast/visitor.rb +4 -0
- data/lib/cucumber/broadcaster.rb +0 -2
- data/lib/cucumber/cli/main.rb +1 -0
- data/lib/cucumber/formatter/console.rb +6 -0
- data/lib/cucumber/formatter/html.rb +5 -1
- data/lib/cucumber/formatter/progress.rb +2 -2
- data/lib/cucumber/formatter/rerun.rb +1 -1
- data/lib/cucumber/step_mother.rb +2 -1
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber/world.rb +12 -1
- data/spec/cucumber/ast/table_spec.rb +3 -3
- data/spec/cucumber/broadcaster_spec.rb +6 -5
- data/spec/cucumber/step_definition_spec.rb +11 -0
- metadata +1 -1
data/History.txt
CHANGED
@@ -92,6 +92,7 @@ pure Ruby users have been enjoying for a while.
|
|
92
92
|
* Pending steps in > steps called from steps (#65 Aslak Hellesøy)
|
93
93
|
|
94
94
|
=== New features
|
95
|
+
* Added World#announce(announcment) which lets you output text to the formatted output (#222 Rob Kaufmann)
|
95
96
|
* Added Table#transpose to to allow use of vertically aligned table keys (Torbjørn Vatn, Aslak Hellesøy)
|
96
97
|
* Added Table#map_headers to to allow use of more readable headers (Rob Holland)
|
97
98
|
* New -S/--step-definitions option. Useful (among other things) for tools that implement automcompletion. (#208 Aslak Hellesøy).
|
data/Manifest.txt
CHANGED
data/lib/cucumber/ast/table.rb
CHANGED
@@ -158,7 +158,7 @@ module Cucumber
|
|
158
158
|
row.map do |cell|
|
159
159
|
cell_with_replaced_args = cell
|
160
160
|
arguments.each do |name, value|
|
161
|
-
cell_with_replaced_args = value &&
|
161
|
+
cell_with_replaced_args = value && cell_with_replaced_args ? cell_with_replaced_args.gsub(name, value) : nil
|
162
162
|
end
|
163
163
|
cell_with_replaced_args
|
164
164
|
end
|
data/lib/cucumber/ast/visitor.rb
CHANGED
data/lib/cucumber/broadcaster.rb
CHANGED
data/lib/cucumber/cli/main.rb
CHANGED
@@ -44,6 +44,7 @@ module Cucumber
|
|
44
44
|
features = load_plain_text_features
|
45
45
|
|
46
46
|
visitor = configuration.build_formatter_broadcaster(step_mother)
|
47
|
+
step_mother.visitor = visitor # Needed to support World#announce
|
47
48
|
visitor.visit_features(features)
|
48
49
|
|
49
50
|
failure = step_mother.steps(:failed).any? ||
|
@@ -116,6 +116,10 @@ module Cucumber
|
|
116
116
|
@builder.td(value, :class => status)
|
117
117
|
end
|
118
118
|
|
119
|
+
def announce(announcement)
|
120
|
+
@builder.pre(announcement, :class => 'announcement')
|
121
|
+
end
|
122
|
+
|
119
123
|
private
|
120
124
|
|
121
125
|
def inline_css
|
@@ -126,4 +130,4 @@ module Cucumber
|
|
126
130
|
|
127
131
|
end
|
128
132
|
end
|
129
|
-
end
|
133
|
+
end
|
data/lib/cucumber/step_mother.rb
CHANGED
@@ -55,7 +55,7 @@ module Cucumber
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
attr_writer :snippet_generator, :options
|
58
|
+
attr_writer :snippet_generator, :options, :visitor
|
59
59
|
|
60
60
|
def step_visited(step)
|
61
61
|
steps << step unless steps.index(step)
|
@@ -180,6 +180,7 @@ module Cucumber
|
|
180
180
|
|
181
181
|
@current_world.extend(World)
|
182
182
|
@current_world.__cucumber_step_mother = self
|
183
|
+
@current_world.__cucumber_visitor = @visitor
|
183
184
|
|
184
185
|
@current_world.extend(::Spec::Matchers) if defined?(::Spec::Matchers)
|
185
186
|
@current_world
|
data/lib/cucumber/version.rb
CHANGED
data/lib/cucumber/world.rb
CHANGED
@@ -7,7 +7,7 @@ module Cucumber
|
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
-
attr_writer :__cucumber_step_mother, :__cucumber_current_step
|
10
|
+
attr_writer :__cucumber_step_mother, :__cucumber_visitor, :__cucumber_current_step
|
11
11
|
|
12
12
|
# Call a step from within a step definition
|
13
13
|
def __cucumber_invoke(name, multiline_argument=nil) #:nodoc:
|
@@ -26,6 +26,17 @@ module Cucumber
|
|
26
26
|
@table_parser.parse_or_fail(text.strip, file, line_offset)
|
27
27
|
end
|
28
28
|
|
29
|
+
# Output +announcement+ alongside the formatted output.
|
30
|
+
# This is an alternative to using Kernel#puts - it will display
|
31
|
+
# nicer, and in all outputs (in case you use several formatters)
|
32
|
+
#
|
33
|
+
# Beware that the output will be printed *before* the corresponding
|
34
|
+
# step. This is because the step itself will not be printed until
|
35
|
+
# after it has run, so it can be coloured according to its status.
|
36
|
+
def announce(announcement)
|
37
|
+
@__cucumber_visitor.announce(announcement)
|
38
|
+
end
|
39
|
+
|
29
40
|
def pending(message = "TODO")
|
30
41
|
if block_given?
|
31
42
|
begin
|
@@ -111,11 +111,11 @@ module Cucumber
|
|
111
111
|
|
112
112
|
it "should not raise an error when there are nil values in the table" do
|
113
113
|
table = Table.new([
|
114
|
-
['book'],
|
115
|
-
[nil]
|
114
|
+
['book', 'qty'],
|
115
|
+
['<book>', nil],
|
116
116
|
])
|
117
117
|
lambda{
|
118
|
-
table.arguments_replaced({'<book>' => '
|
118
|
+
table.arguments_replaced({'<book>' => nil, '<qty>' => '5'})
|
119
119
|
}.should_not raise_error
|
120
120
|
end
|
121
121
|
|
@@ -2,13 +2,14 @@ require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
2
|
|
3
3
|
module Cucumber
|
4
4
|
describe Broadcaster do
|
5
|
+
before do
|
6
|
+
@receiver = mock('receiver')
|
7
|
+
@broadcaster = Broadcaster.new([@receiver])
|
8
|
+
end
|
5
9
|
|
6
10
|
it "should broadcast methods to registered objects" do
|
7
|
-
receiver
|
8
|
-
broadcaster
|
9
|
-
|
10
|
-
receiver.should_receive(:konbanwa).with('good evening')
|
11
|
-
broadcaster.konbanwa('good evening')
|
11
|
+
@receiver.should_receive(:konbanwa).with('good evening')
|
12
|
+
@broadcaster.konbanwa('good evening')
|
12
13
|
end
|
13
14
|
end
|
14
15
|
end
|
@@ -66,5 +66,16 @@ module Cucumber
|
|
66
66
|
stepdef.to_s.should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
|
67
67
|
stepdef.to_s(2).should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
|
68
68
|
end
|
69
|
+
|
70
|
+
it "should allow announce" do
|
71
|
+
v = mock('visitor')
|
72
|
+
v.should_receive(:announce).with('wasup')
|
73
|
+
self.visitor = v
|
74
|
+
world = new_world!
|
75
|
+
Given /Loud/ do
|
76
|
+
announce 'wasup'
|
77
|
+
end
|
78
|
+
step_match("Loud").invoke(world, nil)
|
79
|
+
end
|
69
80
|
end
|
70
81
|
end
|