diff --git a/features/docs/defining_steps/nested_steps_with_second_arg.feature b/features/docs/defining_steps/nested_steps_with_second_arg.feature index 8b7b7eb38b..8b1ed219c9 100644 --- a/features/docs/defining_steps/nested_steps_with_second_arg.feature +++ b/features/docs/defining_steps/nested_steps_with_second_arg.feature @@ -34,7 +34,7 @@ Feature: Nested Steps with either table or doc string """ - Scenario: Use #step with docstring + Scenario: Use #step with Doc String Given a step definition that looks like this: """ruby Given /two turtles/ do @@ -44,30 +44,11 @@ Feature: Nested Steps with either table or doc string And a step definition that looks like this: """ruby Given /turtles:/ do |text| - puts text + puts "#{text}:#{text.class}" end """ When I run the feature with the progress formatter Then the output should contain: """ - Sturm and Lioville - """ - - Scenario: Use #step with docstring and content-type - Given a step definition that looks like this: - """ruby - Given /two turtles/ do - step %{turtles:}, doc_string('Sturm and Lioville','math') - end - """ - And a step definition that looks like this: - """ruby - Given /turtles:/ do |text| - puts text.content_type - end - """ - When I run the feature with the progress formatter - Then the output should contain: - """ - math + Sturm and Lioville:String """ diff --git a/features/docs/gherkin/doc_strings.feature b/features/docs/gherkin/doc_strings.feature index e468e5db20..f2eb180ae8 100644 --- a/features/docs/gherkin/doc_strings.feature +++ b/features/docs/gherkin/doc_strings.feature @@ -53,22 +53,22 @@ Feature: Doc strings Three """ - Scenario: DocString with interesting content type + Scenario: DocString passed as String Given a scenario with a step that looks like this: """gherkin Given I have some code for you: - \"\"\"ruby - # hello + \"\"\" + hello \"\"\" """ And a step definition that looks like this: """ruby Given /code/ do |text| - puts text.content_type + puts text.class end """ When I run the feature with the progress formatter Then the output should contain: """ - ruby + String """ diff --git a/lib/cucumber/multiline_argument/doc_string.rb b/lib/cucumber/multiline_argument/doc_string.rb index b6a3f7292d..e9c24af905 100644 --- a/lib/cucumber/multiline_argument/doc_string.rb +++ b/lib/cucumber/multiline_argument/doc_string.rb @@ -2,9 +2,8 @@ module Cucumber module MultilineArgument class DocString < SimpleDelegator def append_to(array) - array << self + array << self.to_s end end end end - diff --git a/lib/cucumber/rb_support/rb_world.rb b/lib/cucumber/rb_support/rb_world.rb index adb27e754f..5d0c91f074 100644 --- a/lib/cucumber/rb_support/rb_world.rb +++ b/lib/cucumber/rb_support/rb_world.rb @@ -74,6 +74,7 @@ def table(text_or_table, file=nil, line_offset=0) # puts "this is ruby code" # %}, 'ruby') def doc_string(string_without_triple_quotes, content_type='', line_offset=0) + STDERR.puts AnsiEscapes.failed + "WARNING: #doc_string is deprecated. Just pass a regular String instead:" + caller[0] + AnsiEscapes.reset # TODO: rename this method to multiline_string @__cucumber_runtime.doc_string(string_without_triple_quotes, content_type, line_offset) end @@ -89,7 +90,7 @@ def announce(*messages) # @note Cucumber might surprise you with the behaviour of this method. Instead # of sending the output directly to STDOUT, Cucumber will intercept and cache # the message until the current step has finished, and then display it. - # + # # If you'd prefer to see the message immediately, call {Kernel.puts} instead. def puts(*messages) @__cucumber_runtime.puts(*messages)