aslakhellesoy-cucumber 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. data/History.txt +36 -3
  2. data/Manifest.txt +15 -0
  3. data/bin/cucumber +2 -1
  4. data/config/hoe.rb +2 -1
  5. data/examples/calculator_ruby_features/features/addition.rb +1 -1
  6. data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -0
  7. data/examples/i18n/de/Rakefile +6 -0
  8. data/examples/i18n/de/features/addition.feature +17 -0
  9. data/examples/i18n/de/features/division.feature +10 -0
  10. data/examples/i18n/de/features/step_definitons/calculator_steps.rb +30 -0
  11. data/examples/i18n/de/lib/calculator.rb +14 -0
  12. data/examples/i18n/en/Rakefile +1 -0
  13. data/examples/i18n/lt/Rakefile +6 -0
  14. data/examples/i18n/lt/features/addition.feature +17 -0
  15. data/examples/i18n/lt/features/division.feature +10 -0
  16. data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +31 -0
  17. data/examples/i18n/lt/lib/calculator.rb +14 -0
  18. data/examples/test_unit/Rakefile +6 -0
  19. data/examples/test_unit/features/step_definitions/test_unit_steps.rb +26 -0
  20. data/examples/test_unit/features/test_unit.feature +9 -0
  21. data/examples/tickets/features/tickets.feature +4 -2
  22. data/lib/autotest/discover.rb +1 -1
  23. data/lib/cucumber.rb +3 -3
  24. data/lib/cucumber/cli.rb +51 -17
  25. data/lib/cucumber/core_ext/proc.rb +31 -16
  26. data/lib/cucumber/executor.rb +35 -15
  27. data/lib/cucumber/formatters/ansicolor.rb +11 -13
  28. data/lib/cucumber/languages.yml +24 -1
  29. data/lib/cucumber/platform.rb +12 -0
  30. data/lib/cucumber/step_mother.rb +7 -1
  31. data/lib/cucumber/tree/feature.rb +3 -1
  32. data/lib/cucumber/tree/scenario.rb +17 -1
  33. data/lib/cucumber/treetop_parser/feature_de.rb +8 -8
  34. data/lib/cucumber/treetop_parser/feature_lt.rb +1591 -0
  35. data/rails_generators/cucumber/templates/webrat_steps.rb +49 -0
  36. data/rails_generators/feature/templates/feature.erb +3 -3
  37. data/spec/cucumber/cli_spec.rb +172 -2
  38. data/spec/cucumber/executor_spec.rb +104 -28
  39. data/spec/cucumber/step_mother_spec.rb +7 -7
  40. data/spec/cucumber/tree/feature_spec.rb +31 -0
  41. data/spec/cucumber/tree/row_scenario_spec.rb +30 -0
  42. data/spec/spec_helper.rb +1 -0
  43. metadata +21 -6
@@ -50,13 +50,6 @@ module Cucumber
50
50
  end
51
51
  end
52
52
 
53
- it "should mark a step as pending if it does not have a proc" do
54
- m = StepMother.new
55
- m.register_step_proc /I have no body/
56
- regexp, args, proc = m.regexp_args_proc "I have no body"
57
- proc.should == StepMother::PENDING
58
- end
59
-
60
53
  it "should report that a step has a definition if the step is registered" do
61
54
  m = StepMother.new
62
55
  m.register_step_proc /I am a real step definition/ do end
@@ -69,6 +62,13 @@ module Cucumber
69
62
 
70
63
  m.has_step_definition?('I am a step without a definition').should be_false
71
64
  end
65
+
66
+ it "should explain to the programmer that step definitions always need a proc" do
67
+ m = StepMother.new
68
+ lambda do
69
+ m.register_step_proc(/no milk today/)
70
+ end.should raise_error(MissingProc, "Step definitions must always have a proc")
71
+ end
72
72
 
73
73
  end
74
74
  end
@@ -3,10 +3,41 @@ require File.dirname(__FILE__) + '/../../spec_helper'
3
3
  module Cucumber
4
4
  module Tree
5
5
  describe Feature do
6
+
6
7
  it "should have padding_length 2 when alone" do
7
8
  feature = Feature.new('header')
8
9
  feature.padding_length.should == 2
9
10
  end
11
+
12
+ describe "creating a Scenario" do
13
+
14
+ it "should create a new scenario for a feature" do
15
+ feature = Feature.new('header')
16
+
17
+ Scenario.should_receive(:new).with(feature, 'test scenario', "19")
18
+
19
+ feature.Scenario('test scenario') {}
20
+ end
21
+
22
+ end
23
+
24
+ describe "creating a Table" do
25
+
26
+ it "should set the table header of the template scenario" do
27
+ feature = Feature.new('header')
28
+ mock_scenario = mock("scenario", :update_table_column_widths => nil)
29
+ Scenario.stub!(:new).and_return(mock_scenario)
30
+ feature.add_scenario('scenario', 5)
31
+
32
+ mock_scenario.should_receive(:table_header=).with(["input_1", "input_2"])
33
+
34
+ feature.Table do |t|
35
+ t | "input_1" | "input_2" | t
36
+ t | 1 | 2 | t
37
+ end
38
+ end
39
+
40
+ end
10
41
  end
11
42
  end
12
43
  end
@@ -4,6 +4,10 @@ module Cucumber
4
4
  module Tree
5
5
  describe RowScenario do
6
6
 
7
+ def mock_scenario(stubs = {})
8
+ mock('scenario', {:update_table_column_widths => nil, :steps => []}.merge(stubs))
9
+ end
10
+
7
11
  describe "pending?" do
8
12
  before :each do
9
13
  @scenario = Scenario.new(nil, '', 1)
@@ -18,8 +22,34 @@ module Cucumber
18
22
  @scenario.create_step('Given', 'a long step', 1)
19
23
  @row_scenario.should_not be_pending
20
24
  end
25
+ end
26
+
27
+ describe "generating row steps" do
28
+
29
+ it "should cache unbound steps" do
30
+ row_scenario = RowScenario.new(mock('feature'), mock_scenario, [], 1)
31
+
32
+ row_scenario.steps.should equal(row_scenario.steps)
33
+ end
21
34
 
35
+ it "should cache bound steps" do
36
+ mock_step = mock('step', :arity => 1)
37
+ row_scenario = RowScenario.new(mock('feature'), mock_scenario(:steps => [mock_step]), [], 1)
38
+
39
+ row_scenario.steps.should equal(row_scenario.steps)
40
+ end
41
+
42
+ it "should regenerate row steps when scenario template steps have been matched" do
43
+ mock_step = mock('step', :arity => 0)
44
+ row_scenario = RowScenario.new(mock('feature'), mock_scenario(:steps => [mock_step]), [], 1)
45
+ unbound_steps = row_scenario.steps
46
+ mock_step.stub!(:arity => 1)
47
+
48
+ unbound_steps.should_not equal(row_scenario.steps)
49
+ end
50
+
22
51
  end
52
+
23
53
  end
24
54
  end
25
55
  end
data/spec/spec_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  gem 'rspec'
3
3
  require 'spec'
4
4
 
5
+ $KCODE='u'
5
6
  $:.unshift(File.dirname(__FILE__) + '/../lib')
6
7
  require 'cucumber'
7
8
  require 'cucumber/treetop_parser/feature_en'
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.9
4
+ version: 0.1.10
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: 2008-11-12 00:00:00 -08:00
12
+ date: 2008-11-25 00:00:00 -08:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -31,22 +31,22 @@ dependencies:
31
31
  version: 1.2.4
32
32
  version:
33
33
  - !ruby/object:Gem::Dependency
34
- name: rspec
34
+ name: diff-lcs
35
35
  version_requirement:
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: 1.1.5
40
+ version: 1.1.2
41
41
  version:
42
42
  - !ruby/object:Gem::Dependency
43
- name: diff-lcs
43
+ name: rspec
44
44
  version_requirement:
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 1.1.2
49
+ version: 1.1.11
50
50
  version:
51
51
  - !ruby/object:Gem::Dependency
52
52
  name: hoe
@@ -104,6 +104,11 @@ files:
104
104
  - examples/i18n/da/features/step_definitons/kalkulator_steps.rb
105
105
  - examples/i18n/da/features/summering.feature
106
106
  - examples/i18n/da/lib/kalkulator.rb
107
+ - examples/i18n/de/Rakefile
108
+ - examples/i18n/de/features/addition.feature
109
+ - examples/i18n/de/features/division.feature
110
+ - examples/i18n/de/features/step_definitons/calculator_steps.rb
111
+ - examples/i18n/de/lib/calculator.rb
107
112
  - examples/i18n/en/Rakefile
108
113
  - examples/i18n/en/features/addition.feature
109
114
  - examples/i18n/en/features/division.feature
@@ -136,6 +141,11 @@ files:
136
141
  - examples/i18n/ja/features/division.feature
137
142
  - examples/i18n/ja/features/step_definitons/calculator_steps.rb
138
143
  - examples/i18n/ja/lib/calculator.rb
144
+ - examples/i18n/lt/Rakefile
145
+ - examples/i18n/lt/features/addition.feature
146
+ - examples/i18n/lt/features/division.feature
147
+ - examples/i18n/lt/features/step_definitons/calculator_steps.rb
148
+ - examples/i18n/lt/lib/calculator.rb
139
149
  - examples/i18n/no/Rakefile
140
150
  - examples/i18n/no/features/step_definitons/kalkulator_steps.rb
141
151
  - examples/i18n/no/features/summering.feature
@@ -166,6 +176,9 @@ files:
166
176
  - examples/selenium/Rakefile
167
177
  - examples/selenium/features/search.feature
168
178
  - examples/selenium/features/step_definitons/stories_steps.rb
179
+ - examples/test_unit/Rakefile
180
+ - examples/test_unit/features/step_definitions/test_unit_steps.rb
181
+ - examples/test_unit/features/test_unit.feature
169
182
  - examples/tickets/Rakefile
170
183
  - examples/tickets/cucumber.yml
171
184
  - examples/tickets/features/step_definitons/tickets_steps.rb
@@ -208,6 +221,7 @@ files:
208
221
  - lib/cucumber/languages.yml
209
222
  - lib/cucumber/model.rb
210
223
  - lib/cucumber/model/table.rb
224
+ - lib/cucumber/platform.rb
211
225
  - lib/cucumber/rails/rspec.rb
212
226
  - lib/cucumber/rails/world.rb
213
227
  - lib/cucumber/rake/task.rb
@@ -234,6 +248,7 @@ files:
234
248
  - lib/cucumber/treetop_parser/feature_id.rb
235
249
  - lib/cucumber/treetop_parser/feature_it.rb
236
250
  - lib/cucumber/treetop_parser/feature_ja.rb
251
+ - lib/cucumber/treetop_parser/feature_lt.rb
237
252
  - lib/cucumber/treetop_parser/feature_nl.rb
238
253
  - lib/cucumber/treetop_parser/feature_no.rb
239
254
  - lib/cucumber/treetop_parser/feature_parser.rb