aslakhellesoy-cucumber 0.1.99.21 → 0.1.99.22

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 (55) hide show
  1. data/History.txt +20 -7
  2. data/Manifest.txt +24 -1
  3. data/examples/i18n/Rakefile +3 -3
  4. data/examples/i18n/fr/features/addition.feature +13 -11
  5. data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +10 -12
  6. data/examples/i18n/fr/lib/calculatrice.rb +1 -1
  7. data/examples/i18n/ja/features/addition.feature +10 -10
  8. data/examples/i18n/ja/features/division.feature +2 -2
  9. data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +3 -3
  10. data/examples/i18n/ko/features/addition.feature +3 -3
  11. data/examples/i18n/ko/features/division.feature +3 -3
  12. data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +2 -9
  13. data/examples/i18n/no/features/support/env.rb +6 -0
  14. data/examples/i18n/zh-TW/Rakefile +6 -0
  15. data/examples/i18n/zh-TW/features/addition.feature +16 -0
  16. data/examples/i18n/zh-TW/features/division.feature +10 -0
  17. data/examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb +24 -0
  18. data/examples/i18n/zh-TW/lib/calculator.rb +14 -0
  19. data/examples/self_test/features/step_definitions/sample_steps.rb +3 -1
  20. data/examples/sinatra/Rakefile +6 -0
  21. data/examples/sinatra/app.rb +14 -0
  22. data/examples/sinatra/features/add.feature +11 -0
  23. data/examples/sinatra/features/step_definitions/add_steps.rb +15 -0
  24. data/examples/sinatra/features/support/env.rb +20 -0
  25. data/examples/sinatra/views/add.erb +5 -0
  26. data/examples/sinatra/views/layout.erb +8 -0
  27. data/features/cucumber_cli.feature +7 -2
  28. data/features/step_definitions/cucumber_steps.rb +0 -1
  29. data/lib/autotest/cucumber_mixin.rb +3 -2
  30. data/lib/cucumber/ast/table.rb +23 -4
  31. data/lib/cucumber/ast/tags.rb +2 -2
  32. data/lib/cucumber/cli/configuration.rb +28 -11
  33. data/lib/cucumber/cli/language_help_formatter.rb +1 -1
  34. data/lib/cucumber/cli/main.rb +8 -1
  35. data/lib/cucumber/formatter/color_io.rb +6 -0
  36. data/lib/cucumber/languages.yml +37 -10
  37. data/lib/cucumber/parser/feature.rb +1 -1
  38. data/lib/cucumber/parser/feature.tt +1 -1
  39. data/lib/cucumber/rake/task.rb +39 -6
  40. data/lib/cucumber/step_definition.rb +7 -0
  41. data/lib/cucumber/step_mother.rb +12 -1
  42. data/lib/cucumber/version.rb +1 -1
  43. data/rails_generators/cucumber/cucumber_generator.rb +22 -3
  44. data/rails_generators/cucumber/templates/cucumber.rake +13 -5
  45. data/rails_generators/cucumber/templates/env.rb +2 -1
  46. data/rails_generators/cucumber/templates/paths.rb +18 -11
  47. data/rails_generators/cucumber/templates/webrat_steps.rb +23 -7
  48. data/spec/cucumber/ast/table_spec.rb +36 -9
  49. data/spec/cucumber/ast/tags_spec.rb +13 -1
  50. data/spec/cucumber/cli/configuration_spec.rb +33 -4
  51. data/spec/cucumber/cli/main_spec.rb +45 -6
  52. data/spec/cucumber/parser/feature_parser_spec.rb +2 -2
  53. data/spec/cucumber/step_definition_spec.rb +8 -0
  54. metadata +21 -4
  55. data/examples/i18n/ja/README.txt +0 -5
@@ -16,7 +16,19 @@ module Cucumber
16
16
  end
17
17
 
18
18
  it "should not be among other tags" do
19
- @tags.should_not be_among(%w{one !two})
19
+ @tags.should_not be_among(%w{one ~two})
20
+ end
21
+
22
+ it "should not be among other tags with @ prefix" do
23
+ @tags.should_not be_among(%w{one ~@two})
24
+ end
25
+
26
+ it "should be among other tags with irrelevant negative tag" do
27
+ @tags.should be_among(%w{~bacon})
28
+ end
29
+
30
+ it "should not be among other tags with irrelevent tag" do
31
+ @tags.should_not be_among(%w{bacon})
20
32
  end
21
33
  end
22
34
  end
@@ -17,16 +17,29 @@ module Cli
17
17
 
18
18
  it "should require files in support paths first" do
19
19
  File.stub!(:directory?).and_return(true)
20
- Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/env.rb"])
20
+ Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/bar.rb"])
21
21
 
22
22
  config = Configuration.new(StringIO.new)
23
23
  config.parse!(%w{--require /features})
24
24
 
25
25
  config.files_to_require.should == [
26
- "/features/support/env.rb",
26
+ "/features/support/bar.rb",
27
27
  "/features/step_definitions/foo.rb"
28
28
  ]
29
29
  end
30
+
31
+ it "should require env.rb files first" do
32
+ File.stub!(:directory?).and_return(true)
33
+ Dir.stub!(:[]).and_return(["/features/support/a_file.rb","/features/support/env.rb"])
34
+
35
+ config = Configuration.new(StringIO.new)
36
+ config.parse!(%w{--require /features})
37
+
38
+ config.files_to_require.should == [
39
+ "/features/support/env.rb",
40
+ "/features/support/a_file.rb"
41
+ ]
42
+ end
30
43
 
31
44
  it "should expand args from YAML file" do
32
45
  given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
@@ -150,7 +163,7 @@ END_OF_MESSAGE
150
163
 
151
164
  config.options[:verbose].should be_true
152
165
  end
153
-
166
+
154
167
  it "should accept --out option" do
155
168
  config = Configuration.new(StringIO.new)
156
169
  config.parse!(%w{--out jalla.txt})
@@ -216,6 +229,22 @@ END_OF_MESSAGE
216
229
  end
217
230
  end
218
231
 
232
+ describe "diff output" do
233
+
234
+ it "is enabled by default" do
235
+ config = Configuration.new
236
+ config.diff_enabled?.should be_true
237
+ end
238
+
239
+ it "is disabled when the --no-diff option is supplied" do
240
+ config = Configuration.new
241
+ config.parse!(%w{--no-diff})
242
+
243
+ config.diff_enabled?.should be_false
244
+ end
245
+
246
+ end
247
+
219
248
  it "should accept multiple --scenario options" do
220
249
  config = Configuration.new
221
250
  config.parse!(['--scenario', "User logs in", '--scenario', "User signs up"])
@@ -236,4 +265,4 @@ END_OF_MESSAGE
236
265
 
237
266
  end
238
267
  end
239
- end
268
+ end
@@ -6,13 +6,25 @@ module Cli
6
6
  describe Main do
7
7
 
8
8
  before(:each) do
9
+ @out = StringIO.new
9
10
  Kernel.stub!(:exit).and_return(nil)
10
11
  end
11
12
 
13
+ it "should print step definitions" do
14
+ step_mother = Object.new.extend(StepMother)
15
+ step_mother.Given(/Bonjour/) {}
16
+ step_mother.Given(/Monde/) {}
17
+ @cli = Main.new(%w{-S}, @out)
18
+ @cli.execute!(step_mother)
19
+ @out.string.should == %{
20
+ /Bonjour/ # spec/cucumber/cli/main_spec.rb:15
21
+ /Monde/ # spec/cucumber/cli/main_spec.rb:16
22
+ }.lstrip
23
+ end
24
+
12
25
  describe "verbose mode" do
13
26
 
14
27
  before(:each) do
15
- @out = StringIO.new
16
28
  @empty_feature = Ast::Feature.new(Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
17
29
  Dir.stub!(:[])
18
30
  end
@@ -39,6 +51,35 @@ module Cli
39
51
 
40
52
  end
41
53
 
54
+ describe "diffing" do
55
+
56
+ before :each do
57
+ @configuration = mock('Configuration', :null_object => true, :print_step_definitions? => nil)
58
+ Configuration.should_receive(:new).and_return(@configuration)
59
+
60
+ @step_mother = mock('StepMother', :null_object => true)
61
+
62
+ @cli = Main.new(nil, @out)
63
+ end
64
+
65
+ it "uses Spec Differ::Default when diff is enabled" do
66
+ @configuration.should_receive(:diff_enabled?).and_return(true)
67
+
68
+ ::Spec::Expectations::Differs::Default.should_receive(:new)
69
+
70
+ @cli.execute!(@step_mother)
71
+ end
72
+
73
+ it "does not use Spec Differ::Default when diff is disabled" do
74
+ @configuration.should_receive(:diff_enabled?).and_return(false)
75
+
76
+ ::Spec::Expectations::Differs::Default.should_not_receive(:new)
77
+
78
+ @cli.execute!(@step_mother)
79
+ end
80
+
81
+ end
82
+
42
83
  describe "--format with class" do
43
84
 
44
85
  describe "in module" do
@@ -128,9 +169,7 @@ module Cli
128
169
  before(:each) do
129
170
  @out = StringIO.new
130
171
  @error = StringIO.new
131
- @cli = Main.new(@out, @error)
132
-
133
- @cli.parse_options!(%w{--format invalid})
172
+ @cli = Main.new(%w{--format invalid}, @out, @error)
134
173
  end
135
174
 
136
175
  xit "should display a format error" do
@@ -144,7 +183,7 @@ module Cli
144
183
  xit "should display --help" do
145
184
  Kernel.stub!(:exit)
146
185
 
147
- @cli.execute!(stub('step mother'))
186
+ @cli.execute!(Object.new.extend(StepMother))
148
187
 
149
188
  @out.string.should include("Usage: cucumber")
150
189
  end
@@ -161,4 +200,4 @@ module Cli
161
200
 
162
201
  end
163
202
  end
164
- end
203
+ end
@@ -94,7 +94,7 @@ Feature: hi
94
94
  Given Pepper
95
95
 
96
96
  @st3
97
- @st4
97
+ @st4 @ST5 @#^%&ST6**!
98
98
  Scenario: Second}).to_sexp.should ==
99
99
  [:feature, "Feature: hi",
100
100
  [:comment, "# FC\n "],
@@ -103,7 +103,7 @@ Feature: hi
103
103
  [:tag, "st1"], [:tag, "st2"],
104
104
  [:step, 7, "Given", "Pepper"]],
105
105
  [:scenario, 11, 'Scenario:', 'Second',
106
- [:tag, "st3"], [:tag, "st4"]]]
106
+ [:tag, "st3"], [:tag, "st4"], [:tag, "ST5"], [:tag, "#^%&ST6**!"]]]
107
107
  end
108
108
  end
109
109
 
@@ -58,5 +58,13 @@ module Cucumber
58
58
  step_definition("Outside").execute(nil, @world)
59
59
  end.should raise_error(Pending, "Do me!")
60
60
  end
61
+
62
+ it "should have a #to_s suitable for automcompletion" do
63
+ stepdef = Given /Hello (.*)/ do
64
+ end
65
+
66
+ stepdef.to_s.should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
67
+ stepdef.to_s(2).should == '/Hello (.*)/ # spec/cucumber/step_definition_spec.rb:63'
68
+ end
61
69
  end
62
70
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aslakhellesoy-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.99.21
4
+ version: 0.1.99.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Aslak Helles\xC3\xB8y"
@@ -9,11 +9,12 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-06 00:00:00 -08:00
12
+ date: 2009-03-10 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: term-ansicolor
17
+ type: :runtime
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
@@ -23,6 +24,7 @@ dependencies:
23
24
  version:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: treetop
27
+ type: :runtime
26
28
  version_requirement:
27
29
  version_requirements: !ruby/object:Gem::Requirement
28
30
  requirements:
@@ -32,6 +34,7 @@ dependencies:
32
34
  version:
33
35
  - !ruby/object:Gem::Dependency
34
36
  name: polyglot
37
+ type: :runtime
35
38
  version_requirement:
36
39
  version_requirements: !ruby/object:Gem::Requirement
37
40
  requirements:
@@ -41,6 +44,7 @@ dependencies:
41
44
  version:
42
45
  - !ruby/object:Gem::Dependency
43
46
  name: diff-lcs
47
+ type: :runtime
44
48
  version_requirement:
45
49
  version_requirements: !ruby/object:Gem::Requirement
46
50
  requirements:
@@ -50,6 +54,7 @@ dependencies:
50
54
  version:
51
55
  - !ruby/object:Gem::Dependency
52
56
  name: builder
57
+ type: :runtime
53
58
  version_requirement:
54
59
  version_requirements: !ruby/object:Gem::Requirement
55
60
  requirements:
@@ -59,6 +64,7 @@ dependencies:
59
64
  version:
60
65
  - !ruby/object:Gem::Dependency
61
66
  name: hoe
67
+ type: :development
62
68
  version_requirement:
63
69
  version_requirements: !ruby/object:Gem::Requirement
64
70
  requirements:
@@ -78,7 +84,6 @@ extra_rdoc_files:
78
84
  - License.txt
79
85
  - Manifest.txt
80
86
  - README.txt
81
- - examples/i18n/ja/README.txt
82
87
  files:
83
88
  - History.txt
84
89
  - License.txt
@@ -143,7 +148,6 @@ files:
143
148
  - examples/i18n/it/features/somma.feature
144
149
  - examples/i18n/it/features/step_definitons/calcolatrice_steps.rb
145
150
  - examples/i18n/it/lib/calcolatrice.rb
146
- - examples/i18n/ja/README.txt
147
151
  - examples/i18n/ja/Rakefile
148
152
  - examples/i18n/ja/features/addition.feature
149
153
  - examples/i18n/ja/features/division.feature
@@ -162,6 +166,7 @@ files:
162
166
  - examples/i18n/no/Rakefile
163
167
  - examples/i18n/no/features/step_definitons/kalkulator_steps.rb
164
168
  - examples/i18n/no/features/summering.feature
169
+ - examples/i18n/no/features/support/env.rb
165
170
  - examples/i18n/no/lib/kalkulator.rb
166
171
  - examples/i18n/pt/Rakefile
167
172
  - examples/i18n/pt/features/adicao.feature
@@ -179,6 +184,11 @@ files:
179
184
  - examples/i18n/zh-CN/features/addition.feature
180
185
  - examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb
181
186
  - examples/i18n/zh-CN/lib/calculator.rb
187
+ - examples/i18n/zh-TW/Rakefile
188
+ - examples/i18n/zh-TW/features/addition.feature
189
+ - examples/i18n/zh-TW/features/division.feature
190
+ - examples/i18n/zh-TW/features/step_definitons/calculator_steps.rb
191
+ - examples/i18n/zh-TW/lib/calculator.rb
182
192
  - examples/java/README.textile
183
193
  - examples/java/Rakefile
184
194
  - examples/java/features/hello.feature
@@ -214,6 +224,13 @@ files:
214
224
  - examples/self_test/features/step_definitions/sample_steps.rb
215
225
  - examples/self_test/features/support/env.rb
216
226
  - examples/self_test/features/support/tag_count_formatter.rb
227
+ - examples/sinatra/Rakefile
228
+ - examples/sinatra/app.rb
229
+ - examples/sinatra/features/add.feature
230
+ - examples/sinatra/features/step_definitions/add_steps.rb
231
+ - examples/sinatra/features/support/env.rb
232
+ - examples/sinatra/views/add.erb
233
+ - examples/sinatra/views/layout.erb
217
234
  - examples/test_unit/Rakefile
218
235
  - examples/test_unit/features/step_definitions/test_unit_steps.rb
219
236
  - examples/test_unit/features/test_unit.feature
@@ -1,5 +0,0 @@
1
- Run the features with
2
-
3
- rake features
4
-
5
- There is a bug in the calculator. Can you spot it and fix it?