aslakhellesoy-cucumber 0.1.99.5 → 0.1.99.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,35 @@
1
+ # Require this file if you need Unicode support.
2
+ require 'cucumber/platform'
3
+ require 'cucumber/formatter/ansicolor'
4
+
5
+ $KCODE='u' unless Cucumber::RUBY_1_9
6
+
7
+ if Cucumber::WINDOWS_MRI && `chcp` =~ /(\d+)/
8
+ codepage = $1.to_i
9
+ codepages = (1251..1252)
10
+
11
+ if codepages.include?(codepage)
12
+ Cucumber::CODEPAGE = "cp#{codepage}"
13
+
14
+ require 'iconv'
15
+ module Kernel
16
+ alias cucumber_print print
17
+ def print(*a)
18
+ begin
19
+ cucumber_print(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
20
+ rescue Iconv::IllegalSequence
21
+ cucumber_print(*a)
22
+ end
23
+ end
24
+
25
+ alias cucumber_puts puts
26
+ def puts(*a)
27
+ begin
28
+ cucumber_puts(*Iconv.iconv(Cucumber::CODEPAGE, "UTF-8", *a))
29
+ rescue Iconv::IllegalSequence
30
+ cucumber_puts(*a)
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -741,6 +741,10 @@ module Cucumber
741
741
  def multi
742
742
  elements[5]
743
743
  end
744
+
745
+ def white
746
+ elements[6]
747
+ end
744
748
  end
745
749
 
746
750
  module Step1
@@ -828,6 +832,10 @@ module Cucumber
828
832
  r11 = SyntaxNode.new(input, index...index)
829
833
  end
830
834
  s0 << r11
835
+ if r11
836
+ r13 = _nt_white
837
+ s0 << r13
838
+ end
831
839
  end
832
840
  end
833
841
  end
@@ -870,13 +878,8 @@ module Cucumber
870
878
  break
871
879
  end
872
880
  end
873
- if s0.empty?
874
- self.index = i0
875
- r0 = nil
876
- else
877
- r0 = SyntaxNode.new(input, i0...index, s0)
878
- r0.extend(ExamplesSections0)
879
- end
881
+ r0 = SyntaxNode.new(input, i0...index, s0)
882
+ r0.extend(ExamplesSections0)
880
883
 
881
884
  node_cache[:examples_sections][start_index] = r0
882
885
 
@@ -892,9 +895,17 @@ module Cucumber
892
895
  elements[3]
893
896
  end
894
897
 
898
+ def eol
899
+ elements[4]
900
+ end
901
+
895
902
  def table
896
903
  elements[5]
897
904
  end
905
+
906
+ def white
907
+ elements[6]
908
+ end
898
909
  end
899
910
 
900
911
  module Examples1
@@ -947,25 +958,15 @@ module Cucumber
947
958
  end
948
959
  s0 << r6
949
960
  if r6
950
- s8, i8 = [], index
951
- loop do
952
- r9 = _nt_eol
953
- if r9
954
- s8 << r9
955
- else
956
- break
957
- end
958
- end
959
- if s8.empty?
960
- self.index = i8
961
- r8 = nil
962
- else
963
- r8 = SyntaxNode.new(input, i8...index, s8)
964
- end
961
+ r8 = _nt_eol
965
962
  s0 << r8
966
963
  if r8
967
- r10 = _nt_table
968
- s0 << r10
964
+ r9 = _nt_table
965
+ s0 << r9
966
+ if r9
967
+ r10 = _nt_white
968
+ s0 << r10
969
+ end
969
970
  end
970
971
  end
971
972
  end
@@ -88,7 +88,7 @@ module Cucumber
88
88
  end
89
89
 
90
90
  rule step
91
- space* step_keyword space* name:line_to_eol (eol+ / eof) multi:multiline_arg? {
91
+ space* step_keyword space* name:line_to_eol (eol+ / eof) multi:multiline_arg? white {
92
92
  def build
93
93
  if multi.respond_to?(:build)
94
94
  Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value, multi.build)
@@ -100,7 +100,7 @@ module Cucumber
100
100
  end
101
101
 
102
102
  rule examples_sections
103
- examples+ {
103
+ examples* {
104
104
  def build
105
105
  elements.map{|e| e.build}
106
106
  end
@@ -108,7 +108,7 @@ module Cucumber
108
108
  end
109
109
 
110
110
  rule examples
111
- space* examples_keyword space* name:line_to_eol? eol+ table {
111
+ space* examples_keyword space* name:line_to_eol? eol table white {
112
112
  def build
113
113
  [examples_keyword.line, examples_keyword.text_value, name.text_value, table.raw]
114
114
  end
@@ -28,13 +28,9 @@ module Cucumber
28
28
  class SyntaxError < StandardError
29
29
  def initialize(parser, file, line_offset)
30
30
  tf = parser.terminal_failures
31
- expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string.inspect}.uniq*', '}"
32
- after = parser.input[parser.index...parser.failure_index]
33
- found = parser.input[parser.failure_index..parser.failure_index]
34
-
31
+ expected = tf.size == 1 ? tf[0].expected_string.inspect : "one of #{tf.map{|f| f.expected_string}.uniq*', '}"
35
32
  line = parser.failure_line + line_offset
36
- message = "#{file}:#{line}:#{parser.failure_column}: " +
37
- "Parse error, expected #{expected}. After #{after.inspect}. Found: #{found.inspect}"
33
+ message = "#{file}:#{line}:#{parser.failure_column}: Parse error, expected #{expected}."
38
34
  super(message)
39
35
  end
40
36
  end
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 99
6
- PATCH = 5 # Set to nil for official release
6
+ PATCH = 6 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -0,0 +1,49 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ require 'cucumber/step_mother'
4
+
5
+ module Cucumber
6
+ describe StepMother do
7
+ before do
8
+ @step_mother = Object.new
9
+ @step_mother.extend(StepMother)
10
+ @visitor = mock('Visitor')
11
+ end
12
+
13
+ it "should format step names" do
14
+ @step_mother.Given(/it (.*) in (.*)/) do |what, month|
15
+ end
16
+ @step_mother.Given(/nope something else/) do |what, month|
17
+ end
18
+ format = @step_mother.step_definition("it snows in april").format_args("it snows in april", "[%s]")
19
+ format.should == "it [snows] in [april]"
20
+ end
21
+
22
+ it "should raise Ambiguous error when multiple step definitions match" do
23
+ @step_mother.Given(/Three (.*) mice/) {|disability|}
24
+ @step_mother.Given(/Three blind (.*)/) {|animal|}
25
+
26
+ lambda do
27
+ @step_mother.step_definition("Three blind mice")
28
+ end.should raise_error(StepMother::Ambiguous, %{Ambiguous match of "Three blind mice":
29
+
30
+ spec/cucumber/step_mother_spec.rb:23:in `/Three (.*) mice/'
31
+ spec/cucumber/step_mother_spec.rb:24:in `/Three blind (.*)/'
32
+
33
+ })
34
+ end
35
+
36
+ it "should raise Undefined error when no step definitions match" do
37
+ lambda do
38
+ @step_mother.step_definition("Three blind mice")
39
+ end.should raise_error(StepMother::Undefined)
40
+ end
41
+
42
+ it "should raise Redundant error when same regexp is registered twice" do
43
+ @step_mother.Given(/Three (.*) mice/) {|disability|}
44
+ lambda do
45
+ @step_mother.Given(/Three (.*) mice/) {|disability|}
46
+ end.should raise_error(StepMother::Redundant)
47
+ end
48
+ end
49
+ end
@@ -4,7 +4,7 @@ Scenario Outline: Joe fails to login
4
4
  Given I login as Joe without the '<Privilege>' privilege
5
5
  When I <Request Method> /admin/<Path>
6
6
  Then I should see the text "Sorry Joe, you're not allowed to see <Path>"
7
-
7
+
8
8
  Examples:
9
9
  | Privilege | Request Method | Path |
10
10
  | user | GET | reports |
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.5
4
+ version: 0.1.99.6
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-01-25 00:00:00 -08:00
12
+ date: 2009-01-26 00:00:00 -08:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -251,12 +251,7 @@ files:
251
251
  - lib/cucumber/formatter/profile.rb
252
252
  - lib/cucumber/formatter/progress.rb
253
253
  - lib/cucumber/formatter/rerun.rb
254
- - lib/cucumber/formatters/autotest_formatter.rb
255
- - lib/cucumber/formatters/cucumber.css
256
- - lib/cucumber/formatters/cucumber.js
257
- - lib/cucumber/formatters/html_formatter.rb
258
- - lib/cucumber/formatters/jquery.js
259
- - lib/cucumber/formatters/pretty_formatter.rb
254
+ - lib/cucumber/formatter/unicode.rb
260
255
  - lib/cucumber/formatters/unicode.rb
261
256
  - lib/cucumber/jbehave.rb
262
257
  - lib/cucumber/languages.yml
@@ -274,7 +269,6 @@ files:
274
269
  - lib/cucumber/rake/task.rb
275
270
  - lib/cucumber/step_definition.rb
276
271
  - lib/cucumber/step_mother.rb
277
- - lib/cucumber/treetop_parser/feature_fi.rb
278
272
  - lib/cucumber/version.rb
279
273
  - pretty.txt
280
274
  - rails_generators/cucumber/USAGE
@@ -305,8 +299,6 @@ files:
305
299
  - spec/cucumber/formatter/html/index.html
306
300
  - spec/cucumber/formatter/html/jquery-1.3.min.js
307
301
  - spec/cucumber/formatter/html/jquery.uitableedit.js
308
- - spec/cucumber/formatters/autotest_formatter_spec.rb
309
- - spec/cucumber/formatters/features.html
310
302
  - spec/cucumber/formatters/profile_formatter_spec.rb
311
303
  - spec/cucumber/parser/feature_parser_spec.rb
312
304
  - spec/cucumber/parser/table_parser_spec.rb
@@ -315,7 +307,7 @@ files:
315
307
  - spec/cucumber/rails/world_spec.rb
316
308
  - spec/cucumber/sell_cucumbers.feature
317
309
  - spec/cucumber/step_definition_spec.rb
318
- - spec/cucumber/step_mom_spec.rb
310
+ - spec/cucumber/step_mother_spec.rb
319
311
  - spec/cucumber/treetop_parser/empty_feature.feature
320
312
  - spec/cucumber/treetop_parser/empty_scenario.feature
321
313
  - spec/cucumber/treetop_parser/empty_scenario_outline.feature