cucumber 0.4.5.rc2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. data/.gitignore +1 -0
  2. data/History.txt +11 -2
  3. data/Rakefile +12 -11
  4. data/VERSION.yml +2 -3
  5. data/cucumber.gemspec +39 -31
  6. data/cucumber.yml +1 -1
  7. data/features/language_help.feature +2 -2
  8. data/features/wire_protocol.feature +167 -48
  9. data/features/wire_protocol_table_diffing.feature +95 -0
  10. data/lib/cucumber/cli/configuration.rb +7 -1
  11. data/lib/cucumber/cli/main.rb +6 -2
  12. data/lib/cucumber/cli/options.rb +9 -9
  13. data/lib/cucumber/feature_file.rb +1 -1
  14. data/lib/cucumber/formatter/color_io.rb +4 -4
  15. data/lib/cucumber/formatter/html.rb +4 -3
  16. data/lib/cucumber/formatter/tag_cloud.rb +1 -0
  17. data/lib/cucumber/formatter/unicode.rb +28 -23
  18. data/lib/cucumber/languages.yml +1 -1
  19. data/lib/cucumber/step_argument.rb +3 -3
  20. data/lib/cucumber/step_match.rb +2 -2
  21. data/lib/cucumber/wire_support/connection.rb +4 -0
  22. data/lib/cucumber/wire_support/request_handler.rb +1 -1
  23. data/lib/cucumber/wire_support/wire_exception.rb +23 -1
  24. data/lib/cucumber/wire_support/wire_language.rb +4 -1
  25. data/lib/cucumber/wire_support/wire_packet.rb +0 -4
  26. data/lib/cucumber/wire_support/wire_protocol.rb +51 -7
  27. data/lib/cucumber/wire_support/wire_step_definition.rb +14 -9
  28. data/spec/cucumber/cli/options_spec.rb +4 -8
  29. data/spec/cucumber/formatter/color_io_spec.rb +7 -5
  30. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +2 -2
  31. data/spec/cucumber/step_match_spec.rb +6 -1
  32. data/spec/cucumber/wire_support/wire_exception_spec.rb +44 -0
  33. data/spec/cucumber/wire_support/wire_step_definition_spec.rb +20 -0
  34. metadata +30 -15
@@ -1,20 +1,25 @@
1
1
  module Cucumber
2
2
  module WireSupport
3
3
  class WireStepDefinition
4
- def initialize(id, connection)
5
- @id, @connection = id, connection
4
+ attr_reader :regexp_source, :file_colon_line
5
+
6
+ def initialize(connection, data)
7
+ @connection = connection
8
+ @id = data['id']
9
+ @regexp_source = data['regexp'] || "Unknown"
10
+ @file_colon_line = data['source'] || "Unknown"
6
11
  end
7
12
 
8
13
  def invoke(args)
9
- @connection.invoke(@id, args)
10
- end
11
-
12
- def regexp_source
13
- "/FIXME/"
14
+ prepared_args = args.map{ |arg| prepare(arg) }
15
+ @connection.invoke(@id, prepared_args)
14
16
  end
15
17
 
16
- def file_colon_line
17
- "FIXME:0"
18
+ private
19
+
20
+ def prepare(arg)
21
+ return arg unless arg.is_a?(Cucumber::Ast::Table)
22
+ arg.raw
18
23
  end
19
24
  end
20
25
  end
@@ -52,15 +52,16 @@ module Cli
52
52
  end
53
53
  end
54
54
 
55
- context '-l LANG or --language LANG' do
55
+ context '--i18n' do
56
56
  context "with LANG specified as 'help'" do
57
57
  it "lists all known langues" do
58
- when_parsing '-l help' do
58
+ when_parsing '--i18n help' do
59
+ require 'cucumber/cli/language_help_formatter'
59
60
  LanguageHelpFormatter.should_receive(:list_languages).with(output_stream)
60
61
  end
61
62
  end
62
63
  it "exits the program" do
63
- when_parsing('--language help') { Kernel.should_receive(:exit) }
64
+ when_parsing('--i18n help') { Kernel.should_receive(:exit) }
64
65
  end
65
66
  end
66
67
  end
@@ -218,11 +219,6 @@ module Cli
218
219
  options[:snippets].should be_false
219
220
  options[:source].should be_false
220
221
  end
221
-
222
- it "uses the language from profile when none is specified on the command line" do
223
- given_cucumber_yml_defined_as({'foo' => '--language fr'})
224
- after_parsing('-p foo') {options[:lang].should == 'fr'}
225
- end
226
222
  end
227
223
 
228
224
  context '-P or --no-profile' do
@@ -6,18 +6,20 @@ module Cucumber
6
6
  describe ColorIO do
7
7
  describe "<<" do
8
8
  it "should convert to a print using kernel" do
9
- color_io = ColorIO.new
9
+ kernel = mock('Kernel')
10
+ color_io = ColorIO.new(kernel, nil)
10
11
 
11
- Kernel.should_receive(:print).with("monkeys")
12
+ kernel.should_receive(:print).with("monkeys")
12
13
 
13
14
  color_io << "monkeys"
14
15
  end
15
16
 
16
17
  it "should allow chained <<" do
17
- color_io = ColorIO.new
18
+ kernel = mock('Kernel')
19
+ color_io = ColorIO.new(kernel, nil)
18
20
 
19
- Kernel.should_receive(:print).with("monkeys")
20
- Kernel.should_receive(:print).with(" are tasty")
21
+ kernel.should_receive(:print).with("monkeys")
22
+ kernel.should_receive(:print).with(" are tasty")
21
23
 
22
24
  color_io << "monkeys" << " are tasty"
23
25
  end
@@ -6,12 +6,12 @@ module Cucumber
6
6
  describe RegexpArgumentMatcher do
7
7
  it "should create 2 arguments" do
8
8
  arguments = RegexpArgumentMatcher.arguments_from(/I (\w+) (\w+)/, "I like fish")
9
- arguments.map{|argument| [argument.val, argument.pos]}.should == [["like", 2], ["fish", 7]]
9
+ arguments.map{|argument| [argument.val, argument.byte_offset]}.should == [["like", 2], ["fish", 7]]
10
10
  end
11
11
 
12
12
  it "should create 2 arguments when first group is optional" do
13
13
  arguments = RegexpArgumentMatcher.arguments_from(/should( not)? be flashed '([^']*?)'$/, "I should be flashed 'Login failed.'")
14
- arguments.map{|argument| [argument.val, argument.pos]}.should == [[nil, nil], ["Login failed.", 21]]
14
+ arguments.map{|argument| [argument.val, argument.byte_offset]}.should == [[nil, nil], ["Login failed.", 21]]
15
15
  end
16
16
  end
17
17
  end
@@ -18,7 +18,7 @@ module Cucumber
18
18
  StepMatch.new(stepdef, name, nil, stepdef.arguments_from(name))
19
19
  end
20
20
 
21
- it "should format one groups when we use Unicode" do
21
+ it "should format one group when we use Unicode" do
22
22
  m = step_match(/I (\w+) ok/, "I æøåÆØÅæøåÆØÅæøåÆØÅæøåÆØÅ ok")
23
23
  m.format_args("<span>%s</span>").should == "I <span>æøåÆØÅæøåÆØÅæøåÆØÅæøåÆØÅ</span> ok"
24
24
  end
@@ -28,6 +28,11 @@ module Cucumber
28
28
  m.format_args("<span>%s</span>").should == "I <span>ate</span> <span>æøåÆØÅæøåÆØÅæøåÆØÅæøåÆØÅ</span> <span>egg</span> this <span>morning</span>"
29
29
  end
30
30
 
31
+ it "should deal with Unicode both inside and outside arguments" do
32
+ m = step_match(/Jæ (\w+) ålsker (\w+) løndet/, "Jæ vø ålsker døtte løndet")
33
+ m.format_args("<span>%s</span>").should == "Jæ <span>vø</span> ålsker <span>døtte</span> løndet"
34
+ end
35
+
31
36
  it "should format groups with format string" do
32
37
  m = step_match(/I (\w+) (\d+) (\w+) this (\w+)/, "I ate 1 egg this morning")
33
38
  m.format_args("<span>%s</span>").should == "I <span>ate</span> <span>1</span> <span>egg</span> this <span>morning</span>"
@@ -0,0 +1,44 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'cucumber/wire_support/wire_language'
3
+
4
+ module Cucumber
5
+ module WireSupport
6
+ describe WireException do
7
+ before(:each) do
8
+ @host, @port = 'localhost', '54321'
9
+ end
10
+ def exception
11
+ WireException.new(@data, @host, @port)
12
+ end
13
+ describe "with just a message" do
14
+ before(:each) do
15
+ @data = {'message' => 'foo'}
16
+ end
17
+ it "should #to_s as expected" do
18
+ exception.to_s.should == "foo"
19
+ end
20
+ end
21
+
22
+ describe "with a message and an exception" do
23
+ before(:each) do
24
+ @data = {'message' => 'foo', 'exception' => 'Bar'}
25
+ end
26
+ it "should #to_s as expected" do
27
+ exception.to_s.should == "foo"
28
+ end
29
+ it "#class.to_s should return the name of the exception" do
30
+ exception.class.to_s.should == 'Bar from localhost:54321'
31
+ end
32
+ end
33
+
34
+ describe "with a custom backtrace" do
35
+ before(:each) do
36
+ @data = {'message' => 'foo', 'backtrace' => ['foo', 'bar', 'baz']}
37
+ end
38
+ it "#backrace should return the custom backtrace" do
39
+ exception.backtrace.should == ['foo', 'bar', 'baz']
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,20 @@
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
+ require 'cucumber/wire_support/wire_language'
3
+
4
+ module Cucumber
5
+ module WireSupport
6
+ describe WireStepDefinition, "#invoke" do
7
+ describe "if one of the arguments is a table" do
8
+ it "should pass the raw table to the connection" do
9
+ connection = mock('connection')
10
+ step_definition = WireStepDefinition.new(connection, 'id' => 'the-id')
11
+ expected_args = ["a","b", [["1","2"],["3","4"]]]
12
+ connection.should_receive(:invoke).with('the-id', expected_args)
13
+ args = ["a","b"]
14
+ args << Cucumber::Ast::Table.new([["1","2"],["3","4"]])
15
+ step_definition.invoke(args)
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5.rc2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-07 00:00:00 +01:00
12
+ date: 2009-12-15 00:00:00 +01:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,7 +18,7 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - "="
21
+ - - ">="
22
22
  - !ruby/object:Gem::Version
23
23
  version: 1.0.4
24
24
  version:
@@ -28,7 +28,7 @@ dependencies:
28
28
  version_requirement:
29
29
  version_requirements: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "="
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 1.4.2
34
34
  version:
@@ -38,7 +38,7 @@ dependencies:
38
38
  version_requirement:
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
- - - "="
41
+ - - ">="
42
42
  - !ruby/object:Gem::Version
43
43
  version: 0.2.9
44
44
  version:
@@ -48,7 +48,7 @@ dependencies:
48
48
  version_requirement:
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "="
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 2.1.2
54
54
  version:
@@ -58,17 +58,27 @@ dependencies:
58
58
  version_requirement:
59
59
  version_requirements: !ruby/object:Gem::Requirement
60
60
  requirements:
61
- - - "="
61
+ - - ">="
62
62
  - !ruby/object:Gem::Version
63
63
  version: 1.1.2
64
64
  version:
65
+ - !ruby/object:Gem::Dependency
66
+ name: json
67
+ type: :runtime
68
+ version_requirement:
69
+ version_requirements: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: 1.2.0
74
+ version:
65
75
  - !ruby/object:Gem::Dependency
66
76
  name: nokogiri
67
77
  type: :development
68
78
  version_requirement:
69
79
  version_requirements: !ruby/object:Gem::Requirement
70
80
  requirements:
71
- - - "="
81
+ - - ">="
72
82
  - !ruby/object:Gem::Version
73
83
  version: 1.4.0
74
84
  version:
@@ -78,7 +88,7 @@ dependencies:
78
88
  version_requirement:
79
89
  version_requirements: !ruby/object:Gem::Requirement
80
90
  requirements:
81
- - - "="
91
+ - - ">="
82
92
  - !ruby/object:Gem::Version
83
93
  version: 0.5.1
84
94
  version:
@@ -88,7 +98,7 @@ dependencies:
88
98
  version_requirement:
89
99
  version_requirements: !ruby/object:Gem::Requirement
90
100
  requirements:
91
- - - "="
101
+ - - ">="
92
102
  - !ruby/object:Gem::Version
93
103
  version: 1.2.9
94
104
  version:
@@ -98,9 +108,9 @@ dependencies:
98
108
  version_requirement:
99
109
  version_requirements: !ruby/object:Gem::Requirement
100
110
  requirements:
101
- - - "="
111
+ - - ">="
102
112
  - !ruby/object:Gem::Version
103
- version: 0.7.3
113
+ version: 0.7.4
104
114
  version:
105
115
  description: A BDD tool written in Ruby
106
116
  email: cukes@googlegroups.com
@@ -459,6 +469,7 @@ files:
459
469
  - features/unicode_table.feature
460
470
  - features/usage_and_stepdefs_formatter.feature
461
471
  - features/wire_protocol.feature
472
+ - features/wire_protocol_table_diffing.feature
462
473
  - features/work_in_progress.feature
463
474
  - gem_tasks/contributors.rake
464
475
  - gem_tasks/environment.rake
@@ -617,8 +628,10 @@ files:
617
628
  - spec/cucumber/treetop_parser/test_dos.feature
618
629
  - spec/cucumber/treetop_parser/with_comments.feature
619
630
  - spec/cucumber/treetop_parser/with_tags.feature
631
+ - spec/cucumber/wire_support/wire_exception_spec.rb
620
632
  - spec/cucumber/wire_support/wire_language_spec.rb
621
633
  - spec/cucumber/wire_support/wire_packet_spec.rb
634
+ - spec/cucumber/wire_support/wire_step_definition_spec.rb
622
635
  - spec/cucumber/world/pending_spec.rb
623
636
  - spec/spec.opts
624
637
  - spec/spec_helper.rb
@@ -632,7 +645,7 @@ post_install_message: |+
632
645
 
633
646
  (::) U P G R A D I N G (::)
634
647
 
635
- Thank you for installing cucumber-0.4.5.rc2.
648
+ Thank you for installing cucumber-0.5.0.
636
649
  Please be sure to read http://wiki.github.com/aslakhellesoy/cucumber/upgrading
637
650
  for important information about this release. Happy cuking!
638
651
 
@@ -650,9 +663,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
650
663
  version:
651
664
  required_rubygems_version: !ruby/object:Gem::Requirement
652
665
  requirements:
653
- - - ">"
666
+ - - ">="
654
667
  - !ruby/object:Gem::Version
655
- version: 1.3.1
668
+ version: "0"
656
669
  version:
657
670
  requirements: []
658
671
 
@@ -696,8 +709,10 @@ test_files:
696
709
  - spec/cucumber/rb_support/regexp_argument_matcher_spec.rb
697
710
  - spec/cucumber/step_match_spec.rb
698
711
  - spec/cucumber/step_mother_spec.rb
712
+ - spec/cucumber/wire_support/wire_exception_spec.rb
699
713
  - spec/cucumber/wire_support/wire_language_spec.rb
700
714
  - spec/cucumber/wire_support/wire_packet_spec.rb
715
+ - spec/cucumber/wire_support/wire_step_definition_spec.rb
701
716
  - spec/cucumber/world/pending_spec.rb
702
717
  - spec/spec_helper.rb
703
718
  - examples/i18n/ar/features/step_definitons/calculator_steps.rb