casecumber 1.0.2.1 → 1.2.1.cb2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) hide show
  1. data/.rvmrc +1 -1
  2. data/.travis.yml +13 -6
  3. data/Gemfile +2 -0
  4. data/History.md +139 -0
  5. data/LICENSE +1 -1
  6. data/README.md +19 -4
  7. data/cucumber.gemspec +16 -29
  8. data/cucumber.yml +3 -3
  9. data/examples/i18n/README.textile +1 -16
  10. data/features/.cucumber/stepdefs.json +612 -0
  11. data/features/backtraces.feature +36 -0
  12. data/features/doc_strings.feature +73 -0
  13. data/features/drb_server_integration.feature +63 -0
  14. data/features/formatter_step_file_colon_line.feature +46 -0
  15. data/features/json_formatter.feature +137 -137
  16. data/features/nested_steps.feature +60 -0
  17. data/features/rerun_formatter.feature +35 -0
  18. data/features/run_specific_scenarios.feature +47 -0
  19. data/features/step_definitions/cucumber-features/cucumber_ruby_mappings.rb +32 -3
  20. data/features/step_definitions/cucumber_steps.rb +15 -0
  21. data/features/step_definitions/drb_steps.rb +3 -0
  22. data/features/support/env.rb +4 -0
  23. data/features/support/feature_factory.rb +50 -0
  24. data/gem_tasks/cucumber.rake +15 -8
  25. data/gem_tasks/yard.rake +18 -0
  26. data/legacy_features/call_steps_from_stepdefs.feature +1 -1
  27. data/legacy_features/cucumber_cli.feature +0 -7
  28. data/legacy_features/default_snippets.feature +3 -2
  29. data/legacy_features/junit_formatter.feature +60 -10
  30. data/legacy_features/language_help.feature +17 -15
  31. data/legacy_features/snippets_when_using_star_keyword.feature +3 -2
  32. data/legacy_features/step_definitions/cucumber_steps.rb +1 -1
  33. data/legacy_features/support/env.rb +1 -1
  34. data/legacy_features/wire_protocol.feature +1 -1
  35. data/lib/cucumber/ast/background.rb +11 -0
  36. data/lib/cucumber/ast/doc_string.rb +10 -29
  37. data/lib/cucumber/ast/feature.rb +6 -2
  38. data/lib/cucumber/ast/feature_element.rb +7 -3
  39. data/lib/cucumber/ast/multiline_argument.rb +30 -0
  40. data/lib/cucumber/ast/outline_table.rb +20 -12
  41. data/lib/cucumber/ast/step.rb +1 -1
  42. data/lib/cucumber/ast/step_invocation.rb +2 -15
  43. data/lib/cucumber/ast/table.rb +67 -38
  44. data/lib/cucumber/ast/tags.rb +7 -7
  45. data/lib/cucumber/ast/tree_walker.rb +5 -5
  46. data/lib/cucumber/cli/configuration.rb +4 -0
  47. data/lib/cucumber/cli/main.rb +1 -0
  48. data/lib/cucumber/cli/options.rb +29 -10
  49. data/lib/cucumber/constantize.rb +1 -1
  50. data/lib/cucumber/core_ext/disable_mini_and_test_unit_autorun.rb +24 -10
  51. data/lib/cucumber/formatter/ansicolor.rb +8 -13
  52. data/lib/cucumber/formatter/console.rb +3 -2
  53. data/lib/cucumber/formatter/cucumber.css +7 -1
  54. data/lib/cucumber/formatter/gherkin_formatter_adapter.rb +6 -2
  55. data/lib/cucumber/formatter/html.rb +14 -8
  56. data/lib/cucumber/formatter/interceptor.rb +62 -0
  57. data/lib/cucumber/formatter/json.rb +0 -12
  58. data/lib/cucumber/formatter/junit.rb +31 -15
  59. data/lib/cucumber/formatter/pretty.rb +3 -3
  60. data/lib/cucumber/formatter/progress.rb +1 -1
  61. data/lib/cucumber/formatter/rerun.rb +31 -8
  62. data/lib/cucumber/formatter/usage.rb +1 -1
  63. data/lib/cucumber/js_support/js_language.rb +1 -1
  64. data/lib/cucumber/js_support/js_snippets.rb +1 -1
  65. data/lib/cucumber/language_support/language_methods.rb +0 -4
  66. data/lib/cucumber/parser/gherkin_builder.rb +13 -14
  67. data/lib/cucumber/platform.rb +1 -1
  68. data/lib/cucumber/py_support/py_language.rb +3 -7
  69. data/lib/cucumber/rb_support/rb_dsl.rb +15 -8
  70. data/lib/cucumber/rb_support/rb_language.rb +3 -17
  71. data/lib/cucumber/rb_support/rb_step_definition.rb +17 -5
  72. data/lib/cucumber/rb_support/rb_transform.rb +5 -2
  73. data/lib/cucumber/rb_support/rb_world.rb +9 -5
  74. data/lib/cucumber/rb_support/regexp_argument_matcher.rb +3 -3
  75. data/lib/cucumber/runtime/results.rb +2 -2
  76. data/lib/cucumber/runtime/support_code.rb +14 -19
  77. data/lib/cucumber/runtime.rb +40 -2
  78. data/lib/cucumber/step_match.rb +3 -4
  79. data/lib/cucumber/term/ansicolor.rb +118 -0
  80. data/lib/cucumber/wire_support/wire_protocol/requests.rb +7 -5
  81. data/lib/cucumber/wire_support/wire_protocol.rb +0 -1
  82. data/lib/cucumber.rb +2 -1
  83. data/spec/cucumber/ast/doc_string_spec.rb +2 -2
  84. data/spec/cucumber/ast/feature_factory.rb +4 -3
  85. data/spec/cucumber/ast/scenario_outline_spec.rb +1 -2
  86. data/spec/cucumber/ast/step_spec.rb +1 -1
  87. data/spec/cucumber/ast/table_spec.rb +61 -27
  88. data/spec/cucumber/cli/configuration_spec.rb +12 -6
  89. data/spec/cucumber/cli/main_spec.rb +2 -2
  90. data/spec/cucumber/cli/options_spec.rb +9 -3
  91. data/spec/cucumber/constantize_spec.rb +16 -0
  92. data/spec/cucumber/formatter/ansicolor_spec.rb +1 -1
  93. data/spec/cucumber/formatter/html_spec.rb +4 -3
  94. data/spec/cucumber/formatter/interceptor_spec.rb +111 -0
  95. data/spec/cucumber/formatter/junit_spec.rb +36 -20
  96. data/spec/cucumber/formatter/progress_spec.rb +2 -2
  97. data/spec/cucumber/rb_support/rb_language_spec.rb +5 -5
  98. data/spec/cucumber/rb_support/rb_step_definition_spec.rb +20 -4
  99. data/spec/cucumber/rb_support/rb_transform_spec.rb +6 -2
  100. data/spec/cucumber/rb_support/regexp_argument_matcher_spec.rb +7 -3
  101. data/spec/cucumber/runtime/results_spec.rb +81 -0
  102. data/spec/cucumber/step_match_spec.rb +8 -4
  103. data/spec/spec_helper.rb +15 -1
  104. metadata +68 -128
  105. data/.gitignore +0 -26
  106. data/.gitmodules +0 -3
  107. data/.yardopts +0 -0
  108. data/Gemfile.lock +0 -115
  109. data/examples/i18n/de/.gitignore +0 -1
  110. data/examples/i18n/en/.gitignore +0 -1
  111. data/examples/i18n/eo/.gitignore +0 -1
  112. data/examples/i18n/fi/.gitignore +0 -1
  113. data/examples/i18n/hu/.gitignore +0 -1
  114. data/examples/i18n/id/.gitignore +0 -1
  115. data/examples/i18n/ja/.gitignore +0 -1
  116. data/examples/i18n/ko/.gitignore +0 -1
  117. data/examples/i18n/lt/.gitignore +0 -1
  118. data/examples/i18n/pl/.gitignore +0 -1
  119. data/examples/i18n/sk/.gitignore +0 -1
  120. data/examples/i18n/tr/.gitignore +0 -1
  121. data/examples/i18n/zh-TW/.gitignore +0 -1
  122. data/examples/python/lib/.gitignore +0 -1
  123. data/examples/ruby2python/lib/.gitignore +0 -1
  124. data/examples/watir/.gitignore +0 -2
  125. data/fixtures/self_test/.gitignore +0 -1
  126. data/lib/cucumber/formatter/pdf.rb +0 -244
  127. data/lib/cucumber/step_argument.rb +0 -9
data/Gemfile.lock DELETED
@@ -1,115 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- casecumber (1.0.2.1)
5
- builder (>= 2.1.2)
6
- diff-lcs (>= 1.1.2)
7
- gherkin (~> 2.4.5)
8
- json (>= 1.4.6)
9
- term-ansicolor (>= 1.0.5)
10
-
11
- GEM
12
- remote: http://rubygems.org/
13
- specs:
14
- aruba (0.4.3)
15
- bcat (>= 0.6.1)
16
- childprocess (>= 0.1.9)
17
- cucumber (>= 0.10.7)
18
- rdiscount (>= 1.6.8)
19
- rspec (>= 2.6.0)
20
- bcat (0.6.1)
21
- rack (~> 1.0)
22
- builder (3.0.0)
23
- capybara (1.0.0)
24
- mime-types (>= 1.16)
25
- nokogiri (>= 1.3.3)
26
- rack (>= 1.0.0)
27
- rack-test (>= 0.5.4)
28
- selenium-webdriver (~> 0.2.0)
29
- xpath (~> 0.1.4)
30
- childprocess (0.1.9)
31
- ffi (~> 1.0.6)
32
- cucumber (1.0.2)
33
- builder (>= 2.1.2)
34
- diff-lcs (>= 1.1.2)
35
- gherkin (~> 2.4.5)
36
- json (>= 1.4.6)
37
- term-ansicolor (>= 1.0.5)
38
- diff-lcs (1.1.2)
39
- ffi (1.0.9)
40
- gherkin (2.4.21)
41
- json (>= 1.4.6)
42
- innate (2011.04)
43
- rack (>= 1.1.0)
44
- json (1.7.5)
45
- json_pure (1.5.3)
46
- mime-types (1.16)
47
- nokogiri (1.5.0)
48
- prawn (0.8.4)
49
- prawn-core (>= 0.8.4, < 0.9)
50
- prawn-layout (>= 0.8.4, < 0.9)
51
- prawn-security (>= 0.8.4, < 0.9)
52
- prawn-core (0.8.4)
53
- prawn-layout (0.8.4)
54
- prawn-security (0.8.4)
55
- rack (1.3.0)
56
- rack-test (0.6.0)
57
- rack (>= 1.0)
58
- rake (0.9.2)
59
- ramaze (2011.01.30)
60
- innate (>= 2010.03)
61
- rdiscount (1.6.8)
62
- rspec (2.6.0)
63
- rspec-core (~> 2.6.0)
64
- rspec-expectations (~> 2.6.0)
65
- rspec-mocks (~> 2.6.0)
66
- rspec-core (2.6.4)
67
- rspec-expectations (2.6.0)
68
- diff-lcs (~> 1.1.2)
69
- rspec-mocks (2.6.0)
70
- rubyzip (0.9.4)
71
- selenium-webdriver (0.2.2)
72
- childprocess (>= 0.1.9)
73
- ffi (>= 1.0.7)
74
- json_pure
75
- rubyzip
76
- simplecov (0.4.2)
77
- simplecov-html (~> 0.4.4)
78
- simplecov-html (0.4.5)
79
- sinatra (1.2.6)
80
- rack (~> 1.1)
81
- tilt (>= 1.2.2, < 2.0)
82
- spork (0.9.0.rc9)
83
- syntax (1.0.0)
84
- term-ansicolor (1.0.7)
85
- tilt (1.3.2)
86
- webrat (0.7.3)
87
- nokogiri (>= 1.2.0)
88
- rack (>= 1.0)
89
- rack-test (>= 0.5.3)
90
- xpath (0.1.4)
91
- nokogiri (~> 1.3)
92
- yard (0.7.1)
93
-
94
- PLATFORMS
95
- ruby
96
-
97
- DEPENDENCIES
98
- aruba (~> 0.4.2)
99
- bcat (= 0.6.1)
100
- capybara (>= 1.0.0)
101
- casecumber!
102
- nokogiri (>= 1.4.4)
103
- prawn (= 0.8.4)
104
- prawn-layout (= 0.8.4)
105
- rack-test (>= 0.5.7)
106
- rake (>= 0.9.2)
107
- ramaze
108
- rdiscount (= 1.6.8)
109
- rspec (>= 2.6.0)
110
- simplecov (>= 0.4.2)
111
- sinatra (>= 1.2.6)
112
- spork (>= 0.9.0.rc7)
113
- syntax (>= 1.0.0)
114
- webrat (>= 0.7.3)
115
- yard (= 0.7.1)
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- features.html
@@ -1 +0,0 @@
1
- *.pyc
@@ -1 +0,0 @@
1
- *.pyc
@@ -1,2 +0,0 @@
1
- *.html
2
- *.png
@@ -1 +0,0 @@
1
- tmp
@@ -1,244 +0,0 @@
1
- require 'cucumber/formatter/console'
2
- require 'cucumber/formatter/io'
3
- require 'fileutils'
4
-
5
- begin
6
- require 'rubygems'
7
- require 'prawn/core'
8
- require "prawn/layout"
9
- rescue LoadError => e
10
- e.message << "\nYou need the prawn gem. Please do 'gem install prawn'"
11
- raise e
12
- end
13
-
14
- module Cucumber
15
- module Formatter
16
-
17
- BLACK = '000000'
18
- GREY = '999999'
19
-
20
- class Pdf
21
- include FileUtils
22
- include Console
23
- include Io
24
- attr_writer :indent
25
-
26
- def initialize(step_mother, path_or_io, options)
27
- @step_mother = step_mother
28
- @file = ensure_file(path_or_io, "pdf")
29
-
30
- if(options[:dry_run])
31
- @status_colors = { :passed => BLACK, :skipped => BLACK, :undefined => BLACK, :failed => BLACK, :putsd => GREY}
32
- else
33
- @status_colors = { :passed => '055902', :skipped => GREY, :undefined => 'F27405', :failed => '730202', :putsd => GREY}
34
- end
35
-
36
- @pdf = Prawn::Document.new
37
- @scrap = Prawn::Document.new
38
- @doc = @scrap
39
- @options = options
40
- @exceptions = []
41
- @indent = 0
42
- @buffer = []
43
- load_cover_page_image
44
- @pdf.text "\n\n\nCucumber features", :align => :center, :size => 32
45
- @pdf.draw_text "Generated: #{Time.now.strftime("%Y-%m-%d %H:%M")}", :size => 10, :at => [0, 24]
46
- @pdf.draw_text "$ cucumber #{ARGV.join(" ")}", :size => 10, :at => [0,10]
47
- unless options[:dry_run]
48
- @pdf.bounding_box [450,100] , :width => 100 do
49
- @pdf.text 'Legend', :size => 10
50
- @status_colors.each do |k,v|
51
- @pdf.fill_color v
52
- @pdf.text k.to_s, :size => 10
53
- @pdf.fill_color BLACK
54
- end
55
- end
56
- end
57
- end
58
-
59
- def load_cover_page_image()
60
- if (!load_image("features/support/logo.png"))
61
- load_image("features/support/logo.jpg")
62
- end
63
- end
64
-
65
- def load_image(image_path)
66
- begin
67
- @pdf.image open(image_path, "rb"), :position => :center, :width => 500
68
- true
69
- rescue Errno::ENOENT
70
- false
71
- end
72
- end
73
-
74
- def puts(message)
75
- @pdf.fill_color(@status_colors[:putsd])
76
- @pdf.text message, :size => 10
77
- @pdf.fill_color BLACK
78
- end
79
-
80
-
81
- def after_features(features)
82
- @pdf.render_file(@file.path)
83
- puts "\ndone"
84
- end
85
-
86
- def feature_name(keyword, name)
87
- @pdf.start_new_page
88
- names = name.split("\n")
89
- @pdf.fill_color GREY
90
- @pdf.text(keyword, :align => :center)
91
- @pdf.fill_color BLACK
92
- names.each_with_index do |nameline, i|
93
- case i
94
- when 0
95
- @pdf.text(nameline.strip, :size => 30, :align => :center )
96
- @pdf.text("\n")
97
- else
98
- @pdf.text(nameline.strip, :size => 12)
99
- end
100
- end
101
- @pdf.move_down(30)
102
- end
103
-
104
- def after_feature_element(feature_element)
105
- flush
106
- end
107
-
108
- def after_feature(feature)
109
- flush
110
- end
111
-
112
- def feature_element_name(keyword, name)
113
- names = name.empty? ? [name] : name.split("\n")
114
- print "."
115
- STDOUT.flush
116
-
117
- keep_with do
118
- @doc.move_down(20)
119
- @doc.fill_color GREY
120
- @doc.text("#{keyword}", :size => 8)
121
- @doc.fill_color BLACK
122
- @doc.text("#{names[0]}", :size => 16)
123
- names[1..-1].each { |s| @doc.text(s, :size => 12) }
124
- @doc.text("\n")
125
- end
126
- end
127
-
128
- def step_result(keyword, step_match, multiline_arg, status, exception, source_indent, background)
129
- @hide_this_step = false
130
- if exception
131
- if @exceptions.include?(exception)
132
- @hide_this_step = true
133
- return
134
- end
135
- @exceptions << exception
136
- end
137
- if status != :failed && @in_background ^ background
138
- @hide_this_step = true
139
- return
140
- end
141
- end
142
-
143
- def step_name(keyword, step_match, status, source_indent, background)
144
- return if @hide_this_step
145
- line = "#{keyword} #{step_match.format_args("%s")}"
146
- colorize(line, status)
147
- end
148
-
149
- def before_background(background)
150
- @in_background = true
151
- end
152
-
153
- def after_background(background)
154
- @in_background = nil
155
- end
156
-
157
- def before_multiline_arg(table)
158
- return if @hide_this_step
159
- if(table.kind_of? Cucumber::Ast::Table)
160
- keep_with do
161
- print_table(table, ['ffffff', 'f0f0f0'])
162
- end
163
- end
164
- end
165
-
166
- #using row_color hack to highlight each row correctly
167
- def before_outline_table(table)
168
- return if @hide_this_step
169
- row_colors = table.example_rows.map { |r| @status_colors[r.status] unless r.status == :skipped}
170
- keep_with do
171
- print_table(table, row_colors)
172
- end
173
- end
174
-
175
- def before_doc_string(string)
176
- return if @hide_this_step
177
- s = %{"""\n#{string}\n"""}.indent(10)
178
- s = s.split("\n").map{|l| l =~ /^\s+$/ ? '' : l}
179
- s.each do |line|
180
- keep_with { @doc.text(line, :size => 8) }
181
- end
182
- end
183
-
184
- def tag_name(tag_name)
185
- return if @hide_this_step
186
- tag = format_string(tag_name, :tag).indent(@indent)
187
- # TODO should we render tags at all? skipped for now. difficult to place due to page breaks
188
- end
189
-
190
- def background_name(keyword, name, file_colon_line, source_indent)
191
- feature_element_name(keyword, name)
192
- end
193
-
194
- def examples_name(keyword, name)
195
- feature_element_name(keyword, name)
196
- end
197
-
198
- def scenario_name(keyword, name, file_colon_line, source_indent)
199
- feature_element_name(keyword, name)
200
- end
201
-
202
- private
203
-
204
- def colorize(text, status)
205
- keep_with do
206
- @doc.fill_color(@status_colors[status] || BLACK)
207
- @doc.text(text)
208
- @doc.fill_color(BLACK)
209
- end
210
- end
211
-
212
- def keep_with(&block)
213
- @buffer << block
214
- end
215
-
216
- def render(doc)
217
- @doc = doc
218
- @buffer.each do |proc|
219
- proc.call
220
- end
221
- end
222
-
223
- # This method does a 'test' rendering on a blank page, to see the rendered height of the buffer
224
- # if that too high for the space left on the age in the real document, we do a page break.
225
- # This obviously doesn't work if a scenario is longer than a whole page (God forbid)
226
- def flush
227
- @scrap.start_new_page
228
- oldy = @scrap.y
229
- render @scrap
230
- height = (oldy - @scrap.y) + 36 # whops magic number
231
- if ((@pdf.y - height) < @pdf.bounds.bottom)
232
- @pdf.start_new_page
233
- end
234
- render @pdf
235
- @pdf.move_down(20)
236
- @buffer = []
237
- end
238
-
239
- def print_table(table, row_colors)
240
- @doc.table(table.rows, :headers => table.headers, :position => :center, :row_colors => row_colors)
241
- end
242
- end
243
- end
244
- end
@@ -1,9 +0,0 @@
1
- module Cucumber
2
- class StepArgument
3
- attr_reader :val, :byte_offset
4
-
5
- def initialize(val, byte_offset)
6
- @val, @byte_offset = val, byte_offset
7
- end
8
- end
9
- end