Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed #announce and #announce_world. Use #puts and #puts(self) inst…

…ead. Closes #67.
  • Loading branch information...
commit 1775af081afc6e3c8677cef08b35c0920eaaa34f 1 parent 9db8aeb
@aslakhellesoy aslakhellesoy authored
View
20 History.txt
@@ -1,5 +1,9 @@
== 0.10.4 (2011-06-01)
+=== Changed features
+* The announce method is deprecated. Use puts instead (#67 Aslak Hellesøy)
+* The announce_world method is gone. Use puts(self) instead (#67 Aslak Hellesøy)
+
=== New Features
* Better JUnit formatter support for sub directories and scenario outlines (#59, #61, #62 Matt Simpson, Kenny Ortmann)
@@ -61,7 +65,7 @@ This should not affect users. The major new feature in this release is ANSICON s
=== Bugfixes
* Superfluous space after step_keyword value in snippet_text message (#679 Aslak Hellesøy)
-* Better Handling for "announce" in HTML formatter (#676 Stephen Kennedy)
+* Better Handling for "puts" in HTML formatter (#676 Stephen Kennedy)
* Too many open files - getcwd (#666 Aslak Hellesøy)
* Cucumber 0.9.3 prevents Test::Unit from running (#677 Aslak Hellesøy)
* Performance degradation when running feature files with over 1000 steps (#675 Dimitri Geshef)
@@ -247,7 +251,7 @@ Parse times are up to 100 times faster.
=== Bugfixes
* Better handling of --guess with optional capture groups (Tim Felgentreff)
* Parsing of rerun.txt can't use Shellwords on Windows (#581 David Esposito)
-* #announce can now take non-String arguments just like Kernel#puts - #to_s is done implicitly. (Aslak Hellesøy)
+* #puts can now take non-String arguments just like Kernel#puts - #to_s is done implicitly. (Aslak Hellesøy)
* Attempt to fix Cucumber::CODEPAGE error again for Windows (#561 Aslak Hellesøy)
* Tab indentation causes multiline step arguments to fail (#585 Aslak Hellesøy)
* Properly pass tags over the wire protocol (Matt Wynne)
@@ -255,8 +259,8 @@ Parse times are up to 100 times faster.
* Snippets are properly printed when using '*' as step keyword. (Used to cause infinite recursion). (Aslak Hellesøy)
=== New features
-* Added #announce_world method, printing the World class and all included modules (Ruby only). (Aslak Hellesøy)
-* Added #announce to the PDF formatter (Nicolas Bessi)
+* Added #puts_world method, printing the World class and all included modules (Ruby only). (Aslak Hellesøy)
+* Added #puts to the PDF formatter (Nicolas Bessi)
* Show fails for After/Before hooks in the progress formatter (#584 Joseph Wilk)
== Changed features
@@ -276,7 +280,7 @@ Parse times are up to 100 times faster.
=== New features
* Added "Angenommen" as German synonym for Given (Sven Fuchs, Aslak Hellesøy)
-* New #ask(question, timeout_seconds=60) method available to stepdefs. Asks for input and #announce-s question and answer. (Aslak Hellesøy)
+* New #ask(question, timeout_seconds=60) method available to stepdefs. Asks for input and #puts-s question and answer. (Aslak Hellesøy)
* Links to step definitions are now clickable in TextMate's HTML report (Rob Aldred)
* Add diff! message to wire protocol to allow for immediate diff response to invokes (Matt Wynne)
* Add tags to begin/end scenario messages on wire protocol to support tagged hooks (#571 Matt Wynne)
@@ -422,13 +426,13 @@ As usual there are several small features and bug fixes.
* New Wire Protocol - allowing out of process execution of Cucumber scenarios. (#428 Matt Wynne)
* Added an example illustrating how to get screenshots in HTML reports (examples/watir) (Aslak Hellesøy)
* Added new #embed(file, mime_type) method to visitors and Ruby Worlds to make it easier to embed screenshots (Aslak Hellesøy)
-* The #announce method available from Ruby Step Definitions will print *after* the step is executed. (#487 Zoltan Penzeli)
+* The #puts method available from Ruby Step Definitions will print *after* the step is executed. (#487 Zoltan Penzeli)
* Add support for rolling back transaction for all open database connections. (John Ferlito)
* Show scenario and step summary in HTML formatter (#285 Joseph Wilk)
* Ast::Table can now be constructed with an Array of Hash. (Aslak Hellesøy)
=== Changed features
-* The #announce method will no longer escape HTML if the html formatter is used. Escaping must be done manually. (Aslak Hellesøy)
+* The #puts method will no longer escape HTML if the html formatter is used. Escaping must be done manually. (Aslak Hellesøy)
=== Bugfixes
* Fixed incorrect rendering of step arguments with UTF8 characters (Aslak Hellesøy)
@@ -1233,7 +1237,7 @@ for multiline arguments are some of the highlights.
=== New features
* Australian translation (Josh Graham)
-* Added World#announce(announcment) which lets you output text to the formatted output (#222 Rob Kaufmann)
+* Added World#puts(announcment) which lets you output text to the formatted output (#222 Rob Kaufmann)
* Added Table#transpose to to allow use of vertically aligned table keys (Torbjørn Vatn, Aslak Hellesøy)
* Added Table#map_headers to to allow use of more readable headers (Rob Holland)
* New -S/--step-definitions option. Useful (among other things) for tools that implement automcompletion. (#208 Aslak Hellesøy).
View
1  features/json_formatter.feature
@@ -142,7 +142,6 @@ Feature: JSON output formatter
"""
- @announce
Scenario: pystring
Given a file named "features/pystring.feature" with:
"""
View
4 features/transforms.feature
@@ -33,7 +33,7 @@ Feature: Transforms
end
Given /^(a Person aged \d+) with blonde hair$/ do |person|
- announce "#{person} and I have blonde hair"
+ puts "#{person} and I have blonde hair"
end
"""
When I run cucumber "features/foo.feature"
@@ -53,7 +53,7 @@ Feature: Transforms
end
Given /^(#{A_PERSON}) with blonde hair$/ do |person|
- announce "#{person} and I have blonde hair"
+ puts "#{person} and I have blonde hair"
end
"""
When I run cucumber "features/foo.feature"
View
110 legacy_features/announce.feature
@@ -1,34 +1,34 @@
-Feature: Delayed announcement
+Feature: Delayed message
Background:
Given a standard Cucumber project directory structure
And a file named "features/step_definitions/steps.rb" with:
"""
- Given /^I use announce with text "(.*)"$/ do |ann| x=1
- announce(ann)
+ Given /^I use puts with text "(.*)"$/ do |ann| x=1
+ puts(ann)
end
- Given /^I use multiple announces$/ do x=1
- announce("Multiple")
- announce(["Announce","Me"])
+ Given /^I use multiple putss$/ do x=1
+ puts("Multiple")
+ puts("Announce","Me")
end
- Given /^I use announcement (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result| x=1
- announce("Last announcement") if line == "3"
- announce("Line: #{line}: #{ann}")
+ Given /^I use message (.+) in line (.+) (?:with result (.+))$/ do |ann, line, result| x=1
+ puts("Last message") if line == "3"
+ puts("Line: #{line}: #{ann}")
fail if result =~ /fail/i
end
- Given /^I use announce and step fails$/ do x=1
- announce("Announce with fail")
+ Given /^I use puts and step fails$/ do x=1
+ puts("Announce with fail")
fail
end
Given /^this step works$/ do x=1
end
- Given /^I announce the world$/ do x=1
- announce_world
+ Given /^I puts the world$/ do x=1
+ puts(self)
end
"""
And a file named "features/f.feature" with:
@@ -36,15 +36,15 @@ Feature: Delayed announcement
Feature: F
Scenario: S
- Given I use announce with text "Ann"
+ Given I use puts with text "Ann"
And this step works
Scenario: S2
- Given I use multiple announces
+ Given I use multiple putss
And this step works
Scenario Outline: S3
- Given I use announcement <ann> in line <line>
+ Given I use message <ann> in line <line>
Examples:
| line | ann |
@@ -53,11 +53,11 @@ Feature: Delayed announcement
| 3 | anno3 |
Scenario: S4
- Given I use announce and step fails
+ Given I use puts and step fails
And this step works
Scenario Outline: s5
- Given I use announcement <ann> in line <line> with result <result>
+ Given I use message <ann> in line <line> with result <result>
Examples:
| line | ann | result |
@@ -65,34 +65,34 @@ Feature: Delayed announcement
| 2 | anno2 | pass |
"""
- And a file named "features/announce_world.feature" with:
+ And a file named "features/puts_world.feature" with:
"""
- Feature: announce_world
- Scenario: announce_world
- Given I announce the world
+ Feature: puts_world
+ Scenario: puts_world
+ Given I puts the world
"""
- Scenario: Delayed announcements feature
+ Scenario: Delayed messages feature
When I run cucumber --format pretty features/f.feature
Then STDERR should be empty
And the output should contain
"""
Feature: F
- Scenario: S # features/f.feature:3
- Given I use announce with text "Ann" # features/step_definitions/steps.rb:1
+ Scenario: S # features/f.feature:3
+ Given I use puts with text "Ann" # features/step_definitions/steps.rb:1
Ann
- And this step works # features/step_definitions/steps.rb:21
+ And this step works # features/step_definitions/steps.rb:21
- Scenario: S2 # features/f.feature:7
- Given I use multiple announces # features/step_definitions/steps.rb:5
+ Scenario: S2 # features/f.feature:7
+ Given I use multiple putss # features/step_definitions/steps.rb:5
Multiple
Announce
Me
- And this step works # features/step_definitions/steps.rb:21
+ And this step works # features/step_definitions/steps.rb:21
- Scenario Outline: S3 # features/f.feature:11
- Given I use announcement <ann> in line <line> # features/f.feature:12
+ Scenario Outline: S3 # features/f.feature:11
+ Given I use message <ann> in line <line> # features/f.feature:12
Examples:
| line | ann |
@@ -100,27 +100,27 @@ Feature: Delayed announcement
| 2 | anno2 |
| 3 | anno3 |
- Scenario: S4 # features/f.feature:20
- Given I use announce and step fails # features/step_definitions/steps.rb:16
+ Scenario: S4 # features/f.feature:20
+ Given I use puts and step fails # features/step_definitions/steps.rb:16
Announce with fail
(RuntimeError)
- ./features/step_definitions/steps.rb:18:in `/^I use announce and step fails$/'
- features/f.feature:21:in `Given I use announce and step fails'
- And this step works # features/step_definitions/steps.rb:21
+ ./features/step_definitions/steps.rb:18:in `/^I use puts and step fails$/'
+ features/f.feature:21:in `Given I use puts and step fails'
+ And this step works # features/step_definitions/steps.rb:21
- Scenario Outline: s5 # features/f.feature:24
- Given I use announcement <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
+ Scenario Outline: s5 # features/f.feature:24
+ Given I use message <ann> in line <line> with result <result> # features/step_definitions/steps.rb:10
Examples:
| line | ann | result |
| 1 | anno1 | fail | Line: 1: anno1
(RuntimeError)
- ./features/step_definitions/steps.rb:13:in `/^I use announcement (.+) in line (.+) (?:with result (.+))$/'
- features/f.feature:25:in `Given I use announcement <ann> in line <line> with result <result>'
+ ./features/step_definitions/steps.rb:13:in `/^I use message (.+) in line (.+) (?:with result (.+))$/'
+ features/f.feature:25:in `Given I use message <ann> in line <line> with result <result>'
| 2 | anno2 | pass | Line: 2: anno2
"""
- Scenario: Non-delayed announcements feature (progress formatter)
+ Scenario: Non-delayed messages feature (progress formatter)
When I run cucumber --format progress features/f.feature
Then the output should contain
"""
@@ -140,25 +140,13 @@ Feature: Delayed announcement
"""
@rspec2
- Scenario: announce world
- When I run cucumber --format progress features/announce_world.feature
- Then the output should contain
- """
- WORLD:
- Object
-
- RSpec::Matchers
- Cucumber::RbSupport::RbWorld
- """
+ Scenario: puts world
+ When I run cucumber --format progress features/puts_world.feature
+ Then the output should contain "RSpec::Matchers"
+ And the output should contain "Cucumber::RbSupport::RbWorld"
@rspec1
- Scenario: announce world
- When I run cucumber --format progress features/announce_world.feature
- Then the output should contain
- """
- WORLD:
- Object
-
- Spec::Matchers
- Cucumber::RbSupport::RbWorld
- """
+ Scenario: puts world
+ When I run cucumber --format progress features/puts_world.feature
+ Then the output should contain "Spec::Matchers"
+ And the output should contain "Cucumber::RbSupport::RbWorld"
View
4 legacy_features/bug_371.feature
@@ -22,9 +22,9 @@ Feature: https://rspec.lighthouseapp.com/projects/16211/tickets/371
Feature: F
Scenario: S
- B
- G
Given G
+ B
+ G
1 scenario (1 passed)
1 step (1 passed)
View
14 legacy_features/bug_600.feature
@@ -52,14 +52,20 @@ Feature: http://rspec.lighthouseapp.com/projects/16211/tickets/600-inconsistent-
When I run cucumber -f progress features/t.feature
Then it should pass with
"""
+
Before scenario
+
Within background
- .--After scenario
+ .--
+ After scenario
+
Before scenario
+
Within background
- .After scenario
-
-
+ .
+ After scenario
+
+
2 scenarios (2 passed)
3 steps (3 passed)
View
4 legacy_features/html_formatter/a.html
@@ -133,7 +133,7 @@
background: #fcfb98;
color: #131313;
}
-.cucumber table td.announcement, td table td.announcement, th table td.announcement {
+.cucumber table td.message, td table td.message, th table td.message {
border-left: 5px solid aqua;
border-bottom: 1px solid aqua;
background: #e0ffff;
@@ -185,7 +185,7 @@
background: #fcfb98;
color: #131313;
}
-.cucumber ol li.announcement, td ol li.announcement, th ol li.announcement {
+.cucumber ol li.message, td ol li.message, th ol li.message {
border-left: 5px solid aqua;
border-bottom: 1px solid aqua;
background: #e0ffff;
View
4 legacy_features/step_definitions/cucumber_steps.rb
@@ -78,6 +78,10 @@
Then("it should #{success}")
end
+Then /^the output should contain "([^"]*)"$/ do |text|
+ last_stdout.should include(text)
+end
+
Then /^the output should contain:?$/ do |text|
last_stdout.should include(text)
end
View
6 lib/cucumber/ast/tree_walker.rb
@@ -142,9 +142,9 @@ def visit_table_cell_value(value, status)
broadcast(value, status)
end
- # Print +announcement+. This method can be called from within StepDefinitions.
- def announce(announcement)
- broadcast(announcement)
+ # Print +messages+. This method can be called from within StepDefinitions.
+ def puts(*messages)
+ broadcast(*messages)
end
# Embed +file+ of +mime_type+ in the formatter. This method can be called from within StepDefinitions.
View
38 lib/cucumber/formatter/console.rb
@@ -26,9 +26,9 @@ def format_step(keyword, step_match, status, source_indent)
format_string(line, status)
end
- def format_string(string, status)
+ def format_string(o, status)
fmt = format_for(status)
- string.split("\n").map do |line|
+ o.to_s.split("\n").map do |line|
if Proc === fmt
fmt.call(line)
else
@@ -131,39 +131,41 @@ def embed(file, mime_type, label)
# no-op
end
- #define @delayed_announcements = [] in your Formatter if you want to
+ #define @delayed_messages = [] in your Formatter if you want to
#activate this feature
- def announce(announcement)
- if @delayed_announcements
- @delayed_announcements << announcement
+ def puts(*messages)
+ if @delayed_messages
+ @delayed_messages += messages
else
if @io
@io.puts
- @io.puts(format_string(announcement, :tag))
+ messages.each do |message|
+ @io.puts(format_string(message, :tag))
+ end
@io.flush
end
end
end
- def print_announcements()
- @delayed_announcements.each {|ann| print_announcement(ann)}
- empty_announcements
+ def print_messages
+ @delayed_messages.each {|message| print_message(message)}
+ empty_messages
end
- def print_table_row_announcements
- return if @delayed_announcements.empty?
- @io.print(format_string(@delayed_announcements.join(', '), :tag).indent(2))
+ def print_table_row_messages
+ return if @delayed_messages.empty?
+ @io.print(format_string(@delayed_messages.join(', '), :tag).indent(2))
@io.flush
- empty_announcements
+ empty_messages
end
- def print_announcement(announcement)
- @io.puts(format_string(announcement, :tag).indent(@indent))
+ def print_message(message)
+ @io.puts(format_string(message, :tag).indent(@indent))
@io.flush
end
- def empty_announcements
- @delayed_announcements = []
+ def empty_messages
+ @delayed_messages = []
end
private
View
4 lib/cucumber/formatter/cucumber.css
@@ -133,7 +133,7 @@ body {
background: #fcfb98;
color: #131313;
}
-.cucumber table td.announcement, td table td.announcement, th table td.announcement {
+.cucumber table td.message, td table td.message, th table td.message {
border-left: 5px solid aqua;
border-bottom: 1px solid aqua;
background: #e0ffff;
@@ -185,7 +185,7 @@ body {
background: #fcfb98;
color: #131313;
}
-.cucumber ol li.announcement, td ol li.announcement, th ol li.announcement {
+.cucumber ol li.message, td ol li.message, th ol li.message {
border-left: 5px solid aqua;
border-bottom: 1px solid aqua;
background: #e0ffff;
View
26 lib/cucumber/formatter/cucumber.sass
@@ -24,9 +24,9 @@ $undefined: #fcfb98
$undefined_border: #faf834
$undefined_text: #131313
-$announcement: #e0ffff
-$announcement_border: aqua
-$announcement_text: #001111
+$message: #e0ffff
+$message_border: aqua
+$message_text: #001111
body
font-size: 0px
@@ -136,11 +136,11 @@ body
border-bottom: $step_bottom $undefined_border
background: $undefined
color: $undefined_text
- td.announcement
- border-left: $step_left $announcement_border
- border-bottom: $step_bottom $announcement_border
- background: $announcement
- color: $announcement_text
+ td.message
+ border-left: $step_left $message_border
+ border-bottom: $step_bottom $message_border
+ background: $message
+ color: $message_text
ol
list-style: none
margin: 0px
@@ -178,11 +178,11 @@ body
border-bottom: $step_bottom $undefined_border
background: $undefined
color: $undefined_text
- li.announcement
- border-left: $step_left $announcement_border
- border-bottom: $step_bottom $announcement_border
- background: $announcement
- color: $announcement_text
+ li.message
+ border-left: $step_left $message_border
+ border-bottom: $step_bottom $message_border
+ background: $message
+ color: $message_text
margin-left: 10px
#summary
margin: 0px
View
36 lib/cucumber/formatter/html.rb
@@ -20,7 +20,7 @@ def initialize(step_mother, path_or_io, options)
@scenario_number = 0
@step_number = 0
@header_red = nil
- @delayed_announcements = []
+ @delayed_messages = []
end
def embed(src, mime_type, label)
@@ -249,7 +249,7 @@ def after_step_result(keyword, step_match, multiline_arg, status, exception, sou
end
end
@builder << '</li>'
- print_announcements
+ print_messages
end
def step_name(keyword, step_match, status, source_indent, background)
@@ -303,7 +303,7 @@ def before_table_row(table_row)
def after_table_row(table_row)
return if @hide_this_step
- print_table_row_announcements
+ print_table_row_messages
@builder << '</tr>'
if table_row.exception
@builder.tr do
@@ -333,35 +333,35 @@ def table_cell_value(value, status)
@col_index += 1
end
- def announce(announcement)
- @delayed_announcements << announcement
- #@builder.pre(announcement, :class => 'announcement')
+ def puts(message)
+ @delayed_messages << message
+ #@builder.pre(message, :class => 'message')
end
- def print_announcements
- return if @delayed_announcements.empty?
+ def print_messages
+ return if @delayed_messages.empty?
#@builder.ol do
- @delayed_announcements.each do |ann|
- @builder.li(:class => 'step announcement') do
+ @delayed_messages.each do |ann|
+ @builder.li(:class => 'step message') do
@builder << ann
end
end
#end
- empty_announcements
+ empty_messages
end
- def print_table_row_announcements
- return if @delayed_announcements.empty?
+ def print_table_row_messages
+ return if @delayed_messages.empty?
- @builder.td(:class => 'announcement') do
- @builder << @delayed_announcements.join(", ")
+ @builder.td(:class => 'message') do
+ @builder << @delayed_messages.join(", ")
end
- empty_announcements
+ empty_messages
end
- def empty_announcements
- @delayed_announcements = []
+ def empty_messages
+ @delayed_messages = []
end
protected
View
10 lib/cucumber/formatter/pdf.rb
@@ -28,9 +28,9 @@ def initialize(step_mother, path_or_io, options)
@file = ensure_file(path_or_io, "pdf")
if(options[:dry_run])
- @status_colors = { :passed => BLACK, :skipped => BLACK, :undefined => BLACK, :failed => BLACK, :announced => GREY}
+ @status_colors = { :passed => BLACK, :skipped => BLACK, :undefined => BLACK, :failed => BLACK, :putsd => GREY}
else
- @status_colors = { :passed => '055902', :skipped => GREY, :undefined => 'F27405', :failed => '730202', :announced => GREY}
+ @status_colors = { :passed => '055902', :skipped => GREY, :undefined => 'F27405', :failed => '730202', :putsd => GREY}
end
@pdf = Prawn::Document.new
@@ -71,9 +71,9 @@ def load_image(image_path)
end
end
- def announce(announcement)
- @pdf.fill_color(@status_colors[:announced])
- @pdf.text announcement, :size => 10
+ def puts(message)
+ @pdf.fill_color(@status_colors[:putsd])
+ @pdf.text message, :size => 10
@pdf.fill_color BLACK
end
View
6 lib/cucumber/formatter/pretty.rb
@@ -25,7 +25,7 @@ def initialize(step_mother, path_or_io, options)
@exceptions = []
@indent = 0
@prefixes = options[:prefixes] || {}
- @delayed_announcements = []
+ @delayed_messages = []
end
def after_features(features)
@@ -150,7 +150,7 @@ def step_name(keyword, step_match, status, source_indent, background)
source_indent = nil unless @options[:source]
name_to_report = format_step(keyword, step_match, status, source_indent)
@io.puts(name_to_report.indent(@scenario_indent + 2))
- print_announcements
+ print_messages
end
def doc_string(string)
@@ -184,7 +184,7 @@ def before_table_row(table_row)
def after_table_row(table_row)
return if !@table || @hide_this_step
- print_table_row_announcements
+ print_table_row_messages
@io.puts
if table_row.exception && !@exceptions.include?(table_row.exception)
print_exception(table_row.exception, table_row.status, @indent)
View
25 lib/cucumber/rb_support/rb_world.rb
@@ -37,9 +37,9 @@ def doc_string(string_with_triple_quotes, file=nil, line_offset=0)
@__cucumber_step_mother.doc_string(string_with_triple_quotes, file, line_offset)
end
- # See StepMother#announce
- def announce(announcement)
- @__cucumber_step_mother.announce(announcement)
+ # See StepMother#puts
+ def puts(*messages)
+ @__cucumber_step_mother.puts(*messages)
end
# See StepMother#ask
@@ -52,15 +52,6 @@ def embed(file, mime_type, label='Screenshot')
@__cucumber_step_mother.embed(file, mime_type, label)
end
- # Prints out the world class, followed by all included modules.
- def announce_world
- announce "WORLD:\n #{self.class}"
- world = self
- (class << self; self; end).instance_eval do
- world.announce " #{included_modules.join("\n ")}"
- end
- end
-
# Mark the matched step as pending.
def pending(message = "TODO")
if block_given?
@@ -88,7 +79,15 @@ def pending(message = "TODO")
# such errors in World we define it to just return a simple String.
#
def inspect #:nodoc:
- sprintf("#<%s:0x%x>", self.class, self.object_id)
+ modules = [self.class]
+ (class << self; self; end).instance_eval do
+ modules += included_modules
+ end
+ sprintf("#<%s:0x%x>", modules.join('+'), self.object_id)
+ end
+
+ def to_s
+ inspect
end
end
end
View
2  lib/cucumber/runtime.rb
@@ -40,7 +40,7 @@ def run!
fire_after_configuration_hook
tree_walker = @configuration.build_tree_walker(self)
- self.visitor = tree_walker # Ugly circular dependency, but needed to support World#announce
+ self.visitor = tree_walker # Ugly circular dependency, but needed to support World#puts
tree_walker.visit_features(features)
end
View
2  lib/cucumber/runtime/for_programming_languages.rb
@@ -16,7 +16,7 @@ def initialize(support_code, user_interface)
def_delegators :@user_interface,
:embed,
:ask,
- :announce,
+ :puts,
:features_paths,
:step_match
View
17 lib/cucumber/runtime/user_interface.rb
@@ -6,18 +6,23 @@ class Runtime
module UserInterface
attr_writer :visitor
- # Output +announcement+ alongside the formatted output.
+ def announce(*messages)
+ STDERR.puts failed("WARNING: #announce is deprecated. Use #puts instead.")
+ puts(*messages)
+ end
+
+ # Output +messages+ alongside the formatted output.
# This is an alternative to using Kernel#puts - it will display
# nicer, and in all outputs (in case you use several formatters)
#
- def announce(msg)
- msg.respond_to?(:join) ? @visitor.announce(msg.join("\n")) : @visitor.announce(msg.to_s)
+ def puts(*messages)
+ @visitor.puts(*messages)
end
# Suspends execution and prompts +question+ to the console (STDOUT).
# An operator (manual tester) can then enter a line of text and hit
# <ENTER>. The entered text is returned, and both +question+ and
- # the result is added to the output using #announce.
+ # the result is added to the output using #puts.
#
# If you want a beep to happen (to grab the manual tester's attention),
# just prepend ASCII character 7 to the question:
@@ -30,7 +35,7 @@ def announce(msg)
def ask(question, timeout_seconds)
STDOUT.puts(question)
STDOUT.flush
- announce(question)
+ puts(question)
if(Cucumber::JRUBY)
answer = jruby_gets(timeout_seconds)
@@ -39,7 +44,7 @@ def ask(question, timeout_seconds)
end
if(answer)
- announce(answer)
+ puts(answer)
answer
else
raise("Waited for input for #{timeout_seconds} seconds, then timed out.")
View
6 spec/cucumber/rb_support/rb_step_definition_spec.rb
@@ -74,10 +74,10 @@ module RbSupport
end.should raise_error(Cucumber::ArityMismatchError)
end
- it "should allow announce" do
- user_interface.should_receive(:announce).with('wasup')
+ it "should allow puts" do
+ user_interface.should_receive(:puts).with('wasup')
dsl.Given /Loud/ do
- announce 'wasup'
+ puts 'wasup'
end
support_code.step_match("Loud").invoke(nil)
Please sign in to comment.
Something went wrong with that request. Please try again.