cucumber 0.10.3 → 0.10.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/History.txt +21 -8
  2. data/cucumber.gemspec +5 -5
  3. data/examples/sinatra/features/support/env.rb +1 -1
  4. data/examples/v8/features/fibonacci.feature +1 -1
  5. data/examples/watir/features/step_definitions/search_steps.rb +1 -1
  6. data/features/json_formatter.feature +1 -2
  7. data/features/transforms.feature +2 -2
  8. data/fixtures/junit/features/scenario_outline.feature +9 -0
  9. data/fixtures/tickets/features.html +1 -1
  10. data/gem_tasks/sdoc.rake +1 -1
  11. data/legacy_features/announce.feature +48 -60
  12. data/legacy_features/bug_371.feature +2 -2
  13. data/legacy_features/bug_600.feature +10 -4
  14. data/legacy_features/html_formatter/a.html +2 -2
  15. data/legacy_features/junit_formatter.feature +30 -1
  16. data/legacy_features/profiles.feature +1 -1
  17. data/legacy_features/step_definitions/cucumber_steps.rb +4 -0
  18. data/lib/cucumber/ast.rb +1 -1
  19. data/lib/cucumber/ast/{py_string.rb → doc_string.rb} +6 -6
  20. data/lib/cucumber/ast/tree_walker.rb +4 -4
  21. data/lib/cucumber/formatter/console.rb +20 -18
  22. data/lib/cucumber/formatter/cucumber.css +2 -2
  23. data/lib/cucumber/formatter/cucumber.sass +13 -13
  24. data/lib/cucumber/formatter/html.rb +23 -23
  25. data/lib/cucumber/formatter/junit.rb +5 -1
  26. data/lib/cucumber/formatter/pdf.rb +6 -6
  27. data/lib/cucumber/formatter/pretty.rb +5 -5
  28. data/lib/cucumber/parser/gherkin_builder.rb +2 -2
  29. data/lib/cucumber/platform.rb +1 -1
  30. data/lib/cucumber/rake/task.rb +13 -1
  31. data/lib/cucumber/rb_support/rb_language.rb +1 -1
  32. data/lib/cucumber/rb_support/rb_world.rb +24 -16
  33. data/lib/cucumber/runtime.rb +1 -1
  34. data/lib/cucumber/runtime/for_programming_languages.rb +3 -3
  35. data/lib/cucumber/runtime/support_code.rb +1 -1
  36. data/lib/cucumber/runtime/user_interface.rb +12 -11
  37. data/lib/cucumber/step_match.rb +1 -1
  38. data/spec/cucumber/ast/doc_string_spec.rb +40 -0
  39. data/spec/cucumber/ast/feature_factory.rb +2 -2
  40. data/spec/cucumber/ast/feature_spec.rb +1 -1
  41. data/spec/cucumber/ast/step_spec.rb +2 -2
  42. data/spec/cucumber/formatter/junit_spec.rb +1 -0
  43. data/spec/cucumber/rb_support/rb_language_spec.rb +1 -1
  44. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +3 -3
  45. metadata +14 -13
  46. data/spec/cucumber/ast/py_string_spec.rb +0 -40
@@ -92,8 +92,8 @@ module Cucumber
92
92
  @table_owner.gherkin_statement(step)
93
93
  multiline_arg = rubify(step.multiline_arg)
94
94
  case(multiline_arg)
95
- when Gherkin::Formatter::Model::PyString
96
- @table_owner.multiline_arg = Ast::PyString.new(multiline_arg.value)
95
+ when Gherkin::Formatter::Model::DocString
96
+ @table_owner.multiline_arg = Ast::DocString.new(multiline_arg.value)
97
97
  when Array
98
98
  @table_owner.multiline_arg = Ast::Table.new(matrix(multiline_arg))
99
99
  end
@@ -4,7 +4,7 @@ require 'rbconfig'
4
4
 
5
5
  module Cucumber
6
6
  unless defined?(Cucumber::VERSION)
7
- VERSION = '0.10.3'
7
+ VERSION = '0.10.5'
8
8
  BINARY = File.expand_path(File.dirname(__FILE__) + '/../../bin/cucumber')
9
9
  LIBDIR = File.expand_path(File.dirname(__FILE__) + '/../../lib')
10
10
  JRUBY = defined?(JRUBY_VERSION)
@@ -70,7 +70,19 @@ module Cucumber
70
70
  end
71
71
 
72
72
  def use_bundler
73
- @bundler.nil? ? File.exist?("./Gemfile") && Gem.available?("bundler") : @bundler
73
+ @bundler.nil? ? File.exist?("./Gemfile") && gem_available?("bundler") : @bundler
74
+ end
75
+
76
+ def gem_available?(gemname)
77
+ gem_available_new_rubygems?(gemname) || gem_available_old_rubygems?(gemname)
78
+ end
79
+
80
+ def gem_available_old_rubygems?(gemname)
81
+ Gem.available?(gemname)
82
+ end
83
+
84
+ def gem_available_new_rubygems?(gemname)
85
+ Gem::Specification.respond_to?(:find_all_by_name) && Gem::Specification.find_all_by_name(gemname).any?
74
86
  end
75
87
 
76
88
  def cmd
@@ -22,7 +22,7 @@ module Cucumber
22
22
  message << first_proc.backtrace_line('World') << "\n"
23
23
  message << second_proc.backtrace_line('World') << "\n\n"
24
24
  message << "Use Ruby modules instead to extend your worlds. See the Cucumber::RbSupport::RbDsl#World RDoc\n"
25
- message << "or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.\n\n"
25
+ message << "or http://wiki.github.com/cucumber/cucumber/a-whole-new-world.\n\n"
26
26
  super(message)
27
27
  end
28
28
  end
@@ -1,7 +1,11 @@
1
+ require 'gherkin/formatter/ansi_escapes'
2
+
1
3
  module Cucumber
2
4
  module RbSupport
3
5
  # All steps are run in the context of an object that extends this module.
4
6
  module RbWorld
7
+ include Gherkin::Formatter::AnsiEscapes
8
+
5
9
  class << self
6
10
  def alias_adverb(adverb)
7
11
  alias_method adverb, :__cucumber_invoke
@@ -32,14 +36,19 @@ module Cucumber
32
36
  @__cucumber_step_mother.table(text_or_table, file, line_offset)
33
37
  end
34
38
 
35
- # See StepMother#py_string
36
- def py_string(string_with_triple_quotes, file=nil, line_offset=0)
37
- @__cucumber_step_mother.py_string(string_with_triple_quotes, file, line_offset)
39
+ # See StepMother#doc_string
40
+ def doc_string(string_with_triple_quotes, file=nil, line_offset=0)
41
+ @__cucumber_step_mother.doc_string(string_with_triple_quotes, file, line_offset)
42
+ end
43
+
44
+ def announce(*messages)
45
+ STDERR.puts failed + "WARNING: #announce is deprecated. Use #puts instead:" + caller[0] + reset
46
+ puts(*messages)
38
47
  end
39
48
 
40
- # See StepMother#announce
41
- def announce(announcement)
42
- @__cucumber_step_mother.announce(announcement)
49
+ # See StepMother#puts
50
+ def puts(*messages)
51
+ @__cucumber_step_mother.puts(*messages)
43
52
  end
44
53
 
45
54
  # See StepMother#ask
@@ -52,15 +61,6 @@ module Cucumber
52
61
  @__cucumber_step_mother.embed(file, mime_type, label)
53
62
  end
54
63
 
55
- # Prints out the world class, followed by all included modules.
56
- def announce_world
57
- announce "WORLD:\n #{self.class}"
58
- world = self
59
- (class << self; self; end).instance_eval do
60
- world.announce " #{included_modules.join("\n ")}"
61
- end
62
- end
63
-
64
64
  # Mark the matched step as pending.
65
65
  def pending(message = "TODO")
66
66
  if block_given?
@@ -88,7 +88,15 @@ module Cucumber
88
88
  # such errors in World we define it to just return a simple String.
89
89
  #
90
90
  def inspect #:nodoc:
91
- sprintf("#<%s:0x%x>", self.class, self.object_id)
91
+ modules = [self.class]
92
+ (class << self; self; end).instance_eval do
93
+ modules += included_modules
94
+ end
95
+ sprintf("#<%s:0x%x>", modules.join('+'), self.object_id)
96
+ end
97
+
98
+ def to_s
99
+ inspect
92
100
  end
93
101
  end
94
102
  end
@@ -40,7 +40,7 @@ module Cucumber
40
40
  fire_after_configuration_hook
41
41
 
42
42
  tree_walker = @configuration.build_tree_walker(self)
43
- self.visitor = tree_walker # Ugly circular dependency, but needed to support World#announce
43
+ self.visitor = tree_walker # Ugly circular dependency, but needed to support World#puts
44
44
 
45
45
  tree_walker.visit_features(features)
46
46
  end
@@ -16,7 +16,7 @@ module Cucumber
16
16
  def_delegators :@user_interface,
17
17
  :embed,
18
18
  :ask,
19
- :announce,
19
+ :puts,
20
20
  :features_paths,
21
21
  :step_match
22
22
 
@@ -59,8 +59,8 @@ module Cucumber
59
59
  #
60
60
  # Is retured as: " hello\nworld"
61
61
  #
62
- def py_string(string_with_triple_quotes, file=nil, line_offset=0)
63
- Ast::PyString.parse(string_with_triple_quotes)
62
+ def doc_string(string_with_triple_quotes, file=nil, line_offset=0)
63
+ Ast::DocString.parse(string_with_triple_quotes)
64
64
  end
65
65
  end
66
66
  end
@@ -19,7 +19,7 @@ module Cucumber
19
19
 
20
20
  def step(step)
21
21
  cucumber_multiline_arg = case(rubify(step.multiline_arg))
22
- when Gherkin::Formatter::Model::PyString
22
+ when Gherkin::Formatter::Model::DocString
23
23
  step.multiline_arg.value
24
24
  when Array
25
25
  Ast::Table.new(step.multiline_arg.map{|row| row.cells})
@@ -5,19 +5,19 @@ module Cucumber
5
5
 
6
6
  module UserInterface
7
7
  attr_writer :visitor
8
-
9
- # Output +announcement+ alongside the formatted output.
8
+
9
+ # Output +messages+ alongside the formatted output.
10
10
  # This is an alternative to using Kernel#puts - it will display
11
11
  # nicer, and in all outputs (in case you use several formatters)
12
12
  #
13
- def announce(msg)
14
- msg.respond_to?(:join) ? @visitor.announce(msg.join("\n")) : @visitor.announce(msg.to_s)
13
+ def puts(*messages)
14
+ @visitor.puts(*messages)
15
15
  end
16
16
 
17
17
  # Suspends execution and prompts +question+ to the console (STDOUT).
18
18
  # An operator (manual tester) can then enter a line of text and hit
19
19
  # <ENTER>. The entered text is returned, and both +question+ and
20
- # the result is added to the output using #announce.
20
+ # the result is added to the output using #puts.
21
21
  #
22
22
  # If you want a beep to happen (to grab the manual tester's attention),
23
23
  # just prepend ASCII character 7 to the question:
@@ -30,7 +30,7 @@ module Cucumber
30
30
  def ask(question, timeout_seconds)
31
31
  STDOUT.puts(question)
32
32
  STDOUT.flush
33
- announce(question)
33
+ puts(question)
34
34
 
35
35
  if(Cucumber::JRUBY)
36
36
  answer = jruby_gets(timeout_seconds)
@@ -39,18 +39,19 @@ module Cucumber
39
39
  end
40
40
 
41
41
  if(answer)
42
- announce(answer)
42
+ puts(answer)
43
43
  answer
44
44
  else
45
45
  raise("Waited for input for #{timeout_seconds} seconds, then timed out.")
46
46
  end
47
47
  end
48
48
 
49
- # Embed +file+ of MIME type +mime_type+ into the output. This may or may
50
- # not be ignored, depending on what kind of formatter(s) are active.
49
+ # Embed +src+ of MIME type +mime_type+ into the output. The +src+ argument may
50
+ # be a path to a file, or if it's an image it may also be a Base64 encoded image.
51
+ # The embedded data may or may not be ignored, depending on what kind of formatter(s) are active.
51
52
  #
52
- def embed(file, mime_type, label)
53
- @visitor.embed(file, mime_type, label)
53
+ def embed(src, mime_type, label)
54
+ @visitor.embed(src, mime_type, label)
54
55
  end
55
56
 
56
57
  private
@@ -20,7 +20,7 @@ module Cucumber
20
20
  end
21
21
 
22
22
  def invoke(multiline_arg)
23
- multiline_arg = Ast::PyString.new(multiline_arg) if String === multiline_arg
23
+ multiline_arg = Ast::DocString.new(multiline_arg) if String === multiline_arg
24
24
  all_args = args
25
25
  all_args << multiline_arg.to_step_definition_arg if multiline_arg
26
26
  @step_definition.invoke(all_args)
@@ -0,0 +1,40 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
2
+ require 'cucumber/ast/doc_string'
3
+
4
+ module Cucumber
5
+ module Ast
6
+ describe DocString do
7
+ describe "replacing arguments" do
8
+
9
+ before(:each) do
10
+ @ps = DocString.new("<book>\n<qty>\n")
11
+ end
12
+
13
+ it "should return a new doc_string with arguments replaced with values" do
14
+ doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere', '<qty>' => '5'})
15
+
16
+ doc_string_with_replaced_arg.to_step_definition_arg.should == "Life is elsewhere\n5\n"
17
+ end
18
+
19
+ it "should not change the original doc_string" do
20
+ doc_string_with_replaced_arg = @ps.arguments_replaced({'<book>' => 'Life is elsewhere'})
21
+
22
+ @ps.to_s.should_not include("Life is elsewhere")
23
+ end
24
+
25
+ it "should replaced nil with empty string" do
26
+ ps = DocString.new("'<book>'")
27
+ doc_string_with_replaced_arg = ps.arguments_replaced({'<book>' => nil})
28
+
29
+ doc_string_with_replaced_arg.to_step_definition_arg.should == "''"
30
+ end
31
+
32
+ it "should recognise when just a subset of a cell is delimited" do
33
+ @ps.should have_text('<qty>')
34
+ end
35
+
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -24,7 +24,7 @@ module Cucumber
24
24
  %w{1 22 333},
25
25
  %w{4444 55555 666666}
26
26
  ])
27
- py_string = Ast::PyString.new(%{\n I like\nCucumber sandwich\n})
27
+ doc_string = Ast::DocString.new(%{\n I like\nCucumber sandwich\n})
28
28
 
29
29
  background = Ast::Background.new(Ast::Comment.new(""), 2, "Background:", "",
30
30
  [
@@ -46,7 +46,7 @@ module Cucumber
46
46
  "Scenario:", "A Scenario",
47
47
  [
48
48
  Step.new(10, "Given", "a passing step with an inline arg:", table),
49
- Step.new(11, "Given", "a happy step with an inline arg:", py_string),
49
+ Step.new(11, "Given", "a happy step with an inline arg:", doc_string),
50
50
  Step.new(12, "Given", "a failing step")
51
51
  ]
52
52
  )]
@@ -40,7 +40,7 @@ module Cucumber
40
40
  [:row, -1,
41
41
  [:cell, "4444"], [:cell, "55555"], [:cell, "666666"]]]],
42
42
  [:step_invocation, 11, "Given", "a happy step with an inline arg:",
43
- [:py_string, "\n I like\nCucumber sandwich\n"]],
43
+ [:doc_string, "\n I like\nCucumber sandwich\n"]],
44
44
  [:step_invocation, 12, "Given", "a failing step"]]]
45
45
  end
46
46
 
@@ -48,9 +48,9 @@ module Cucumber
48
48
  end
49
49
 
50
50
  it "should replace arguments in py string arg" do
51
- py_string = PyString.new('taste_<taste> color_<color>')
51
+ doc_string = DocString.new('taste_<taste> color_<color>')
52
52
 
53
- step = Step.new(1, 'Given', 'a <color> cucumber', py_string)
53
+ step = Step.new(1, 'Given', 'a <color> cucumber', doc_string)
54
54
 
55
55
  invocation_table = Table.new([
56
56
  %w{color taste},
@@ -94,6 +94,7 @@ module Cucumber::Formatter
94
94
  it { @doc.to_s.should =~ /Big Mac/ }
95
95
  it { @doc.to_s.should_not =~ /Things/ }
96
96
  it { @doc.to_s.should_not =~ /Good|Evil/ }
97
+ it { @doc.to_s.should_not =~ /type="skipped"/}
97
98
  end
98
99
 
99
100
  describe "with a regular data table scenario" do
@@ -144,7 +144,7 @@ spec/cucumber/rb_support/rb_language_spec.rb:\\d+:in `World'
144
144
  spec/cucumber/rb_support/rb_language_spec.rb:\\d+:in `World'
145
145
 
146
146
  Use Ruby modules instead to extend your worlds. See the Cucumber::RbSupport::RbDsl#World RDoc
147
- or http://wiki.github.com/aslakhellesoy/cucumber/a-whole-new-world.
147
+ or http://wiki.github.com/cucumber/cucumber/a-whole-new-world.
148
148
 
149
149
  }
150
150
  dsl.World { Hash.new }
@@ -74,10 +74,10 @@ module Cucumber
74
74
  end.should raise_error(Cucumber::ArityMismatchError)
75
75
  end
76
76
 
77
- it "should allow announce" do
78
- user_interface.should_receive(:announce).with('wasup')
77
+ it "should allow puts" do
78
+ user_interface.should_receive(:puts).with('wasup')
79
79
  dsl.Given /Loud/ do
80
- announce 'wasup'
80
+ puts 'wasup'
81
81
  end
82
82
 
83
83
  support_code.step_match("Loud").invoke(nil)
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.10.3
5
+ version: 0.10.5
6
6
  platform: ruby
7
7
  authors:
8
8
  - "Aslak Helles\xC3\xB8y"
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-23 00:00:00 +01:00
13
+ date: 2011-06-06 00:00:00 +01:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -19,9 +19,9 @@ dependencies:
19
19
  requirement: &id001 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
- - - ">="
22
+ - - ~>
23
23
  - !ruby/object:Gem::Version
24
- version: 2.3.8
24
+ version: 2.4.0
25
25
  type: :runtime
26
26
  version_requirements: *id001
27
27
  - !ruby/object:Gem::Dependency
@@ -153,7 +153,7 @@ dependencies:
153
153
  requirements:
154
154
  - - ">="
155
155
  - !ruby/object:Gem::Version
156
- version: 0.8.4
156
+ version: 0.9.0.rc7
157
157
  type: :development
158
158
  version_requirements: *id013
159
159
  - !ruby/object:Gem::Dependency
@@ -164,7 +164,7 @@ dependencies:
164
164
  requirements:
165
165
  - - ">="
166
166
  - !ruby/object:Gem::Version
167
- version: 0.4.1
167
+ version: 0.4.2
168
168
  type: :development
169
169
  version_requirements: *id014
170
170
  - !ruby/object:Gem::Dependency
@@ -208,7 +208,7 @@ dependencies:
208
208
  requirements:
209
209
  - - ">="
210
210
  - !ruby/object:Gem::Version
211
- version: 1.2.0
211
+ version: 1.2.6
212
212
  type: :development
213
213
  version_requirements: *id018
214
214
  - !ruby/object:Gem::Dependency
@@ -513,6 +513,7 @@ files:
513
513
  - fixtures/json/features/tables.feature
514
514
  - fixtures/junit/features/one_passing_one_failing.feature
515
515
  - fixtures/junit/features/pending.feature
516
+ - fixtures/junit/features/scenario_outline.feature
516
517
  - fixtures/junit/features/some_subdirectory/one_passing_one_failing.feature
517
518
  - fixtures/junit/features/step_definitions/steps.rb
518
519
  - fixtures/self_test/.gitignore
@@ -647,12 +648,12 @@ files:
647
648
  - lib/cucumber/ast.rb
648
649
  - lib/cucumber/ast/background.rb
649
650
  - lib/cucumber/ast/comment.rb
651
+ - lib/cucumber/ast/doc_string.rb
650
652
  - lib/cucumber/ast/examples.rb
651
653
  - lib/cucumber/ast/feature.rb
652
654
  - lib/cucumber/ast/feature_element.rb
653
655
  - lib/cucumber/ast/features.rb
654
656
  - lib/cucumber/ast/outline_table.rb
655
- - lib/cucumber/ast/py_string.rb
656
657
  - lib/cucumber/ast/scenario.rb
657
658
  - lib/cucumber/ast/scenario_outline.rb
658
659
  - lib/cucumber/ast/step.rb
@@ -742,10 +743,10 @@ files:
742
743
  - lib/cucumber/wire_support/wire_protocol/requests.rb
743
744
  - lib/cucumber/wire_support/wire_step_definition.rb
744
745
  - spec/cucumber/ast/background_spec.rb
746
+ - spec/cucumber/ast/doc_string_spec.rb
745
747
  - spec/cucumber/ast/feature_factory.rb
746
748
  - spec/cucumber/ast/feature_spec.rb
747
749
  - spec/cucumber/ast/outline_table_spec.rb
748
- - spec/cucumber/ast/py_string_spec.rb
749
750
  - spec/cucumber/ast/scenario_outline_spec.rb
750
751
  - spec/cucumber/ast/scenario_spec.rb
751
752
  - spec/cucumber/ast/step_spec.rb
@@ -790,8 +791,8 @@ licenses: []
790
791
 
791
792
  post_install_message: "\n\
792
793
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n\
793
- Thank you for installing cucumber-0.10.3.\n\
794
- Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading\n\
794
+ Thank you for installing cucumber-0.10.5.\n\
795
+ Please be sure to read http://wiki.github.com/cucumber/cucumber/upgrading\n\
795
796
  for important information about this release. Happy cuking!\n\n\
796
797
  (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::) (::)\n\n"
797
798
  rdoc_options:
@@ -816,7 +817,7 @@ rubyforge_project:
816
817
  rubygems_version: 1.6.2
817
818
  signing_key:
818
819
  specification_version: 3
819
- summary: cucumber-0.10.3
820
+ summary: cucumber-0.10.5
820
821
  test_files:
821
822
  - features/background.feature
822
823
  - features/bootstrap.feature
@@ -832,10 +833,10 @@ test_files:
832
833
  - features/tagged_hooks.feature
833
834
  - features/transforms.feature
834
835
  - spec/cucumber/ast/background_spec.rb
836
+ - spec/cucumber/ast/doc_string_spec.rb
835
837
  - spec/cucumber/ast/feature_factory.rb
836
838
  - spec/cucumber/ast/feature_spec.rb
837
839
  - spec/cucumber/ast/outline_table_spec.rb
838
- - spec/cucumber/ast/py_string_spec.rb
839
840
  - spec/cucumber/ast/scenario_outline_spec.rb
840
841
  - spec/cucumber/ast/scenario_spec.rb
841
842
  - spec/cucumber/ast/step_spec.rb