aslakhellesoy-cucumber 0.1.99.10 → 0.1.99.11

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -57,6 +57,7 @@ Scenario Outlines, the rich command line, the nice output format and everything
57
57
  pure Ruby users have been enjoying for a while.
58
58
 
59
59
  == Bugfixes
60
+ * -n option does not suppress the line info for a Scenario Outline (#175 Aslak Hellesøy)
60
61
  * Errors with rspec-rails matchers in cucumber 0.1.99 (#173 David Chelimsky)
61
62
  * Can't use an empty string as a table value in a scenario outline (#172 Aslak Hellesøy)
62
63
  * Really skip skipped steps (#90 Aslak Hellesøy)
@@ -68,6 +69,7 @@ pure Ruby users have been enjoying for a while.
68
69
  * Pending steps in > steps called from steps (#65 Aslak Hellesøy)
69
70
 
70
71
  === New features
72
+ * New --no-multiline option to reduce noise. Useful if lots of features are failing.
71
73
  * Added ability to pass URIs to cucumber in addition to files and directories. Useful for troubleshooting! (Aslak Hellesøy)
72
74
  * Groups of tabular scenarios (#57 Aslak Hellesøy)
73
75
  * Tagging scenarios and features. Pick the ones to run with --tags (#54 Aslak Hellesøy)
@@ -90,7 +92,7 @@ pure Ruby users have been enjoying for a while.
90
92
  * "More Examples" is gone. "Scenario" + "More Examples" is no longer supported. Use "Scenario Outline" + "Examples" instead.
91
93
  * Pure Ruby features are no longer supported.
92
94
 
93
- == 0.1.16
95
+ == (0.16.4 aslakhellesoy-webrat gem on GitHub)
94
96
 
95
97
  Bugfix release.
96
98
 
@@ -109,6 +111,7 @@ to this:
109
111
  * Use Webrat's #contain matcher in generated "I should (not) see" step definitions (Bryan Helmkamp)
110
112
 
111
113
  == Bugfixes
114
+ * Escaped quotes - \" - inside multiline strings will be unescaped.
112
115
  * Flush output in HTML formatter since JRuby doesnt do it automatically (Diego Carrion)
113
116
  * Better handling of ARGV (#169 David Chelimsky, Ben Mabey)
114
117
  * Compatibility with ruby-debug (do ARGV.dup in bin/cucumber so it can restart ruby with same args) (Aslak Hellesøy)
data/License.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008 Aslak Hellesøy
1
+ Copyright (c) 2008,2009 Aslak Hellesøy
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/Manifest.txt CHANGED
@@ -175,7 +175,8 @@ lib/cucumber/ast/table.rb
175
175
  lib/cucumber/ast/tags.rb
176
176
  lib/cucumber/ast/visitor.rb
177
177
  lib/cucumber/broadcaster.rb
178
- lib/cucumber/cli.rb
178
+ lib/cucumber/cli/language_help_formatter.rb
179
+ lib/cucumber/cli/main.rb
179
180
  lib/cucumber/core_ext/exception.rb
180
181
  lib/cucumber/core_ext/instance_exec.rb
181
182
  lib/cucumber/core_ext/proc.rb
@@ -206,7 +207,6 @@ lib/cucumber/rake/task.rb
206
207
  lib/cucumber/step_definition.rb
207
208
  lib/cucumber/step_mother.rb
208
209
  lib/cucumber/version.rb
209
- pretty.txt
210
210
  rails_generators/cucumber/USAGE
211
211
  rails_generators/cucumber/cucumber_generator.rb
212
212
  rails_generators/cucumber/templates/cucumber
@@ -226,7 +226,7 @@ spec/cucumber/ast/scenario_spec.rb
226
226
  spec/cucumber/ast/step_spec.rb
227
227
  spec/cucumber/ast/table_spec.rb
228
228
  spec/cucumber/broadcaster_spec.rb
229
- spec/cucumber/cli_spec.rb
229
+ spec/cucumber/cli/main_spec.rb
230
230
  spec/cucumber/core_ext/proc_spec.rb
231
231
  spec/cucumber/core_ext/string_spec.rb
232
232
  spec/cucumber/formatter/ansicolor_spec.rb
data/bin/cucumber CHANGED
@@ -2,5 +2,5 @@
2
2
  # Add '.rb' to work around a bug in IronRuby's File#dirname
3
3
  $:.unshift(File.dirname(__FILE__ + '.rb') + '/../lib') unless $:.include?(File.dirname(__FILE__ + '.rb') + '/../lib')
4
4
 
5
- require 'cucumber/cli'
6
- Cucumber::CLI.execute(ARGV.dup)
5
+ require 'cucumber/cli/main'
6
+ Cucumber::Cli::Main.execute(ARGV.dup)
@@ -14,3 +14,6 @@ Feature: Sample
14
14
  @four
15
15
  Scenario: Failing
16
16
  Given failing
17
+ """
18
+ hello
19
+ """
@@ -5,7 +5,7 @@ end
5
5
  Given /^passing$/ do |table|
6
6
  end
7
7
 
8
- Given /^failing$/ do
8
+ Given /^failing$/ do |string|
9
9
  flunker
10
10
  end
11
11
 
@@ -50,6 +50,9 @@ Feature: Cucumber command line
50
50
  @four
51
51
  Scenario: Failing
52
52
  Given failing
53
+ \"\"\"
54
+ hello
55
+ \"\"\"
53
56
  FAIL (RuntimeError)
54
57
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
55
58
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
@@ -199,6 +202,9 @@ Feature: Cucumber command line
199
202
  @four
200
203
  Scenario: Failing
201
204
  Given failing
205
+ \"\"\"
206
+ hello
207
+ \"\"\"
202
208
 
203
209
  11 scenarios
204
210
  11 skipped steps
@@ -293,6 +299,9 @@ Feature: Cucumber command line
293
299
  @four
294
300
  Scenario: Failing
295
301
  Given failing
302
+ \"\"\"
303
+ hello
304
+ \"\"\"
296
305
  FAIL (RuntimeError)
297
306
  ./features/step_definitions/sample_steps.rb:2:in `flunker'
298
307
  ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
@@ -325,6 +334,9 @@ Feature: Cucumber command line
325
334
  @four
326
335
  Scenario: Failing
327
336
  Given failing
337
+ \"\"\"
338
+ hello
339
+ \"\"\"
328
340
 
329
341
 
330
342
  """
@@ -19,7 +19,7 @@ module Cucumber
19
19
  class PyString
20
20
  def initialize(start_line, end_line, string, quotes_indent)
21
21
  @start_line, @end_line = start_line, end_line
22
- @string, @quotes_indent = string, quotes_indent
22
+ @string, @quotes_indent = string.gsub(/\\"/, '"'), quotes_indent
23
23
  end
24
24
 
25
25
  def to_s
@@ -46,7 +46,7 @@ module Cucumber
46
46
  def to_sexp #:nodoc:
47
47
  [:py_string, to_s]
48
48
  end
49
-
49
+
50
50
  end
51
51
  end
52
52
  end
@@ -0,0 +1,58 @@
1
+ require 'cucumber/formatter/pretty'
2
+
3
+ module Cucumber
4
+ module Cli2
5
+ class LanguageHelpFormatter < Formatter::Pretty
6
+ INCOMPLETE = %{
7
+ This language is incomplete. Please translate the missing words in
8
+ #{Cucumber::LANGUAGE_FILE}
9
+
10
+ Then contribute back to the Cucumber project. Details here:
11
+ http://wiki.github.com/aslakhellesoy/cucumber/spoken-languages
12
+ }
13
+
14
+ def self.list_languages(io)
15
+ raw = Cucumber::LANGUAGES.keys.sort.map do |lang|
16
+ [lang, Cucumber::LANGUAGES[lang]['name'], Cucumber::LANGUAGES[lang]['native']]
17
+ end
18
+ table = Ast::Table.new(raw)
19
+ new(nil, io, {:check_lang=>true}, '').visit_multiline_arg(table, :passed)
20
+ end
21
+
22
+ def self.list_keywords(io, lang)
23
+ Cucumber.load_language(lang)
24
+ raw = Cucumber::KEYWORD_KEYS.map do |key|
25
+ [key, Cucumber::LANGUAGES[lang][key]]
26
+ end
27
+ table = Ast::Table.new(raw)
28
+ new(nil, io, {:incomplete => Cucumber.language_incomplete?}, '').visit_multiline_arg(table, :passed)
29
+ end
30
+
31
+ def visit_multiline_arg(table, status)
32
+ if @options[:incomplete]
33
+ @io.puts(format_string(INCOMPLETE, :failed))
34
+ end
35
+ super
36
+ end
37
+
38
+ def visit_table_row(table_row, status)
39
+ @col = 1
40
+ super
41
+ end
42
+
43
+ def visit_table_cell_value(value, width, status)
44
+ if @col == 1
45
+ if(@options[:check_lang])
46
+ @incomplete = Cucumber.language_incomplete?(value)
47
+ end
48
+ status = :comment
49
+ elsif @incomplete
50
+ status = :failed
51
+ end
52
+
53
+ @col += 1
54
+ super(value, width, status)
55
+ end
56
+ end
57
+ end
58
+ end
@@ -3,11 +3,13 @@ require 'cucumber'
3
3
  require 'ostruct'
4
4
  require 'cucumber/parser'
5
5
  require 'cucumber/formatter'
6
+ require 'cucumber/cli/language_help_formatter'
6
7
 
7
8
  module Cucumber
9
+ module Cli
8
10
  class YmlLoadError < StandardError; end
9
11
 
10
- class CLI
12
+ class Main
11
13
  class << self
12
14
  def step_mother=(step_mother)
13
15
  @step_mother = step_mother
@@ -54,11 +56,11 @@ module Cucumber
54
56
  args.extend(OptionParser::Arguable)
55
57
 
56
58
  args.options do |opts|
57
- opts.banner = ["Usage: cucumber [options] [[FILE[:LINE[:LINE]*]] | [FILES|DIRS]]", "",
59
+ opts.banner = ["Usage: cucumber [options] [ [FILE|DIR|URL][:LINE[:LINE]*] ]+", "",
58
60
  "Examples:",
59
61
  "cucumber examples/i18n/en/features",
60
62
  "cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
61
- "cucumber --no-snippets http://tinyurl.com/cuke-mastermind", "", "",
63
+ "cucumber -n -i http://rubyurl.com/eeCl", "", "",
62
64
  ].join("\n")
63
65
  opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
64
66
  "Require files before executing the features. If this",
@@ -136,16 +138,16 @@ module Cucumber
136
138
  @options[:dry_run] = true
137
139
  @quiet = true
138
140
  end
139
- opts.on("-m", "--[no-]multiline",
140
- "Don't print multiline strings and tables under steps.") do |v|
141
- @options[:source] = v
141
+ opts.on("-m", "--no-multiline",
142
+ "Don't print multiline strings and tables under steps.") do
143
+ @options[:no_multiline] = true
142
144
  end
143
- opts.on("-n", "--[no-]source",
144
- "Don't show the file and line of the step definition with the steps.") do |v|
145
- @options[:source] = v
145
+ opts.on("-n", "--no-source",
146
+ "Don't print the file and line of the step definition with the steps.") do
147
+ @options[:source] = false
146
148
  end
147
- opts.on("-i", "--[no-]snippets", "Don't show the snippets for pending steps.") do |v|
148
- @options[:snippets] = v
149
+ opts.on("-i", "--no-snippets", "Don't print snippets for pending steps.") do
150
+ @options[:snippets] = false
149
151
  end
150
152
  opts.on("-q", "--quiet", "Alias for --no-snippets --no-source.") do
151
153
  @quiet = true
@@ -181,6 +183,10 @@ module Cucumber
181
183
 
182
184
  def execute!(step_mother)
183
185
  Cucumber.load_language(@options[:lang])
186
+ if Cucumber.language_incomplete?
187
+ list_keywords(Cucumber.lang)
188
+ end
189
+
184
190
  require_files
185
191
  enable_diffing
186
192
  features = load_plain_text_features
@@ -366,50 +372,19 @@ Defined profiles in cucumber.yml:
366
372
  end
367
373
 
368
374
  def list_languages
369
- raw = Cucumber::LANGUAGES.keys.sort.map do |lang|
370
- [lang, Cucumber::LANGUAGES[lang]['name'], Cucumber::LANGUAGES[lang]['native']]
371
- end
372
- print_lang_table(raw, {:check_lang=>true})
375
+ Cli2::LanguageHelpFormatter.list_languages(@out_stream)
376
+ Kernel.exit
373
377
  end
374
378
 
375
379
  def list_keywords(lang)
376
380
  unless Cucumber::LANGUAGES[lang]
377
- exit_with_error("No language with key #{v}")
378
- end
379
- raw = Cucumber::KEYWORD_KEYS.map do |key|
380
- [key, Cucumber::LANGUAGES[lang][key]]
381
- end
382
- print_lang_table(raw, {})
383
- end
384
-
385
- def print_lang_table(raw, options)
386
- table = Ast::Table.new(raw)
387
- formatter = Formatter::Pretty.new(nil, @out_stream, options, '')
388
-
389
- def formatter.visit_table_row(table_row, status)
390
- @col = 1
391
- super
381
+ exit_with_error("No language with key #{lang}")
392
382
  end
393
-
394
- def formatter.visit_table_cell_value(value, width, status)
395
- if @col == 1
396
- if(@options[:check_lang])
397
- @incomplete = Cucumber.language_complete?(value)
398
- end
399
- status = :comment
400
- elsif @incomplete
401
- status = :failed
402
- end
403
-
404
- @col += 1
405
- super(value, width, status)
406
- end
407
-
408
- formatter.indent = 0
409
- formatter.visit_multiline_arg(table, :passed)
383
+ Cli2::LanguageHelpFormatter.list_keywords(@out_stream, lang)
410
384
  Kernel.exit
411
385
  end
412
386
  end
413
387
  end
388
+ end
414
389
 
415
- Cucumber::CLI.step_mother = self
390
+ Cucumber::Cli::Main.step_mother = self
@@ -18,6 +18,7 @@ module Cucumber
18
18
  @io = io
19
19
  @options = options
20
20
  @delim = delim
21
+ @indent = 0
21
22
  end
22
23
 
23
24
  def visit_features(features)
@@ -120,6 +121,7 @@ module Cucumber
120
121
  end
121
122
 
122
123
  def visit_multiline_arg(multiline_arg, status)
124
+ return if @options[:no_multiline]
123
125
  multiline_arg.accept(self, status)
124
126
  end
125
127
 
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
5
  TINY = 99
6
- PATCH = 10 # Set to nil for official release
6
+ PATCH = 11 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
data/lib/cucumber.rb CHANGED
@@ -7,7 +7,7 @@ require 'rubygems'
7
7
  require 'cucumber/parser'
8
8
  require 'cucumber/version'
9
9
  require 'cucumber/step_mother'
10
- require 'cucumber/cli'
10
+ require 'cucumber/cli/main'
11
11
  require 'cucumber/broadcaster'
12
12
  require 'cucumber/core_ext/exception'
13
13
 
@@ -24,7 +24,7 @@ module Cucumber
24
24
  Parser.load_parser(keyword_hash)
25
25
  end
26
26
 
27
- def language_complete?(lang)
27
+ def language_incomplete?(lang=@lang)
28
28
  KEYWORD_KEYS.detect{|key| keyword_hash(lang)[key].nil?}
29
29
  end
30
30
 
@@ -56,7 +56,7 @@ module Cucumber
56
56
 
57
57
  it "should pretty print" do
58
58
  require 'cucumber/formatter/pretty'
59
- visitor = Formatter::Pretty.new(@step_mother, STDOUT, {:source => true})
59
+ visitor = Formatter::Pretty.new(@step_mother, STDOUT, {:comment => true})
60
60
  visitor.visit_feature_element(@scenario_outline)
61
61
  end
62
62
  end
@@ -1,8 +1,9 @@
1
- require File.dirname(__FILE__) + '/../spec_helper'
1
+ require File.dirname(__FILE__) + '/../../spec_helper'
2
2
  require 'yaml'
3
3
 
4
4
  module Cucumber
5
- describe CLI do
5
+ module Cli
6
+ describe Main do
6
7
 
7
8
  def mock_executor(stubs = {})
8
9
  stub('executor', {:visit_features => nil, :lines_for_features= => nil, :failed => false, :formatters= => nil}.merge(stubs))
@@ -27,7 +28,7 @@ module Cucumber
27
28
  end
28
29
 
29
30
  it "should expand args from YAML file" do
30
- cli = CLI.new
31
+ cli = Main.new
31
32
 
32
33
  given_cucumber_yml_defined_as({'bongo' => '--require from/yml'})
33
34
 
@@ -37,7 +38,7 @@ module Cucumber
37
38
  end
38
39
 
39
40
  it "should expand args from YAML file's default if there are no args" do
40
- cli = CLI.new
41
+ cli = Main.new
41
42
 
42
43
  given_cucumber_yml_defined_as({'default' => '--require from/yml'})
43
44
 
@@ -46,7 +47,7 @@ module Cucumber
46
47
  end
47
48
 
48
49
  it "should provide a helpful error message when a specified profile does not exists in YAML file" do
49
- cli = CLI.new(StringIO.new, error = StringIO.new)
50
+ cli = Main.new(StringIO.new, error = StringIO.new)
50
51
 
51
52
  given_cucumber_yml_defined_as({'default' => '--require from/yml', 'html_report' => '--format html'})
52
53
 
@@ -64,7 +65,7 @@ END_OF_MESSAGE
64
65
  end
65
66
 
66
67
  it "should provide a helpful error message when a specified profile is not a String" do
67
- cli = CLI.new(StringIO.new, error = StringIO.new)
68
+ cli = Main.new(StringIO.new, error = StringIO.new)
68
69
 
69
70
  given_cucumber_yml_defined_as({'foo' => [1,2,3]})
70
71
 
@@ -75,7 +76,7 @@ END_OF_MESSAGE
75
76
 
76
77
  it "should provide a helpful error message when a specified profile exists but is nil or blank" do
77
78
  [nil, ' '].each do |bad_input|
78
- cli = CLI.new(StringIO.new, error = StringIO.new)
79
+ cli = Main.new(StringIO.new, error = StringIO.new)
79
80
 
80
81
  given_cucumber_yml_defined_as({'foo' => bad_input})
81
82
 
@@ -86,7 +87,7 @@ END_OF_MESSAGE
86
87
  end
87
88
 
88
89
  it "should provide a helpful error message when no YAML file exists and a profile is specified" do
89
- cli = CLI.new(StringIO.new, error = StringIO.new)
90
+ cli = Main.new(StringIO.new, error = StringIO.new)
90
91
 
91
92
  File.should_receive(:exist?).with('cucumber.yml').and_return(false)
92
93
 
@@ -99,7 +100,7 @@ END_OF_MESSAGE
99
100
  expected_error_message = /cucumber.yml was found, but was blank or malformed. Please refer to cucumber's documentaion on correct profile usage./
100
101
 
101
102
  ['', 'sfsadfs', "--- \n- an\n- array\n", "---dddfd"].each do |bad_input|
102
- cli = CLI.new(StringIO.new, error = StringIO.new)
103
+ cli = Main.new(StringIO.new, error = StringIO.new)
103
104
 
104
105
  given_cucumber_yml_defined_as(bad_input)
105
106
  cli.parse_options!([])
@@ -110,7 +111,7 @@ END_OF_MESSAGE
110
111
 
111
112
  it "should procide a helpful error message when the YAML can not be parsed" do
112
113
  expected_error_message = /cucumber.yml was found, but could not be parsed. Please refer to cucumber's documentaion on correct profile usage./
113
- cli = CLI.new(StringIO.new, error = StringIO.new)
114
+ cli = Main.new(StringIO.new, error = StringIO.new)
114
115
 
115
116
  given_cucumber_yml_defined_as("input that causes an exception in YAML loading")
116
117
  YAML.should_receive(:load).and_raise Exception
@@ -121,28 +122,28 @@ END_OF_MESSAGE
121
122
  end
122
123
 
123
124
  it "should accept --dry-run option" do
124
- cli = CLI.new(StringIO.new)
125
+ cli = Main.new(StringIO.new)
125
126
  cli.parse_options!(%w{--dry-run})
126
127
  cli.options[:dry_run].should be_true
127
128
  cli.execute!(stub('step mother'))
128
129
  end
129
130
 
130
131
  it "should accept --no-source option" do
131
- cli = CLI.new
132
+ cli = Main.new
132
133
  cli.parse_options!(%w{--no-source})
133
134
 
134
135
  cli.options[:source].should be_false
135
136
  end
136
137
 
137
138
  it "should accept --no-snippets option" do
138
- cli = CLI.new
139
+ cli = Main.new
139
140
  cli.parse_options!(%w{--no-snippets})
140
141
 
141
142
  cli.options[:snippets].should be_false
142
143
  end
143
144
 
144
145
  it "should set snippets and source to false with --quiet option" do
145
- cli = CLI.new
146
+ cli = Main.new
146
147
  cli.parse_options!(%w{--quiet})
147
148
 
148
149
  cli.options[:snippets].should be_nil
@@ -150,7 +151,7 @@ END_OF_MESSAGE
150
151
  end
151
152
 
152
153
  it "should accept --verbose option" do
153
- cli = CLI.new
154
+ cli = Main.new
154
155
  cli.parse_options!(%w{--verbose})
155
156
 
156
157
  cli.options[:verbose].should be_true
@@ -160,7 +161,7 @@ END_OF_MESSAGE
160
161
  File.stub!(:directory?).and_return(true)
161
162
  Dir.stub!(:[]).and_return(["/features/step_definitions/foo.rb","/features/support/env.rb"])
162
163
 
163
- cli = CLI.new(StringIO.new)
164
+ cli = Main.new(StringIO.new)
164
165
  cli.parse_options!(%w{--require /features})
165
166
 
166
167
  cli.should_receive(:require).with("/features/support/env.rb").ordered
@@ -174,7 +175,7 @@ END_OF_MESSAGE
174
175
 
175
176
  before(:each) do
176
177
  @out = StringIO.new
177
- @cli = CLI.new(@out)
178
+ @cli = Main.new(@out)
178
179
  @cli.stub!(:require)
179
180
  @empty_feature = Ast::Feature.new(Ast::Comment.new(''), Ast::Tags.new(2, []), "Feature", [])
180
181
  Dir.stub!(:[])
@@ -199,26 +200,26 @@ END_OF_MESSAGE
199
200
  end
200
201
 
201
202
  it "should accept --out option" do
202
- cli = CLI.new(StringIO.new)
203
+ cli = Main.new(StringIO.new)
203
204
  cli.parse_options!(%w{--out jalla.txt})
204
205
  cli.options[:formats]['pretty'].should == 'jalla.txt'
205
206
  end
206
207
 
207
208
  it "should accept multiple --out options" do
208
- cli = CLI.new(StringIO.new)
209
+ cli = Main.new(StringIO.new)
209
210
  cli.parse_options!(%w{--format progress --out file1 --out file2})
210
211
  cli.options[:formats].should == {'progress' => 'file2'}
211
212
  end
212
213
 
213
214
  it "should accept multiple --format options" do
214
- cli = CLI.new(StringIO.new)
215
+ cli = Main.new(StringIO.new)
215
216
  cli.parse_options!(%w{--format pretty --format progress})
216
217
  cli.options[:formats].should have_key('pretty')
217
218
  cli.options[:formats].should have_key('progress')
218
219
  end
219
220
 
220
221
  it "should associate --out to previous --format" do
221
- cli = CLI.new(StringIO.new)
222
+ cli = Main.new(StringIO.new)
222
223
  cli.parse_options!(%w{--format progress --out file1 --format profile --out file2})
223
224
  cli.options[:formats].should == {"profile"=>"file2", "progress"=>"file1"}
224
225
  end
@@ -228,7 +229,7 @@ END_OF_MESSAGE
228
229
  describe "in module" do
229
230
 
230
231
  it "should resolve each module until it gets Formatter class" do
231
- cli = CLI.new(nil)
232
+ cli = Main.new(nil)
232
233
  mock_module = mock('module')
233
234
  cli.parse_options!(%w{--format ZooModule::MonkeyFormatterClass})
234
235
  Object.stub!(:const_defined?).and_return(true)
@@ -253,7 +254,7 @@ END_OF_MESSAGE
253
254
  end
254
255
 
255
256
  xit "should create the formatter" do
256
- cli = CLI.new
257
+ cli = Main.new
257
258
  mock_formatter = mock('magical formatter')
258
259
  cli.parse_options!(%w{--format magical})
259
260
 
@@ -263,7 +264,7 @@ END_OF_MESSAGE
263
264
  end
264
265
 
265
266
  xit "should register the formatter with broadcaster" do
266
- cli = CLI.new
267
+ cli = Main.new
267
268
  broadcaster = Broadcaster.new
268
269
  mock_formatter = mock('magical formatter')
269
270
  Broadcaster.stub!(:new).and_return(broadcaster, stub("output broadcaster", :register => nil))
@@ -282,7 +283,7 @@ END_OF_MESSAGE
282
283
  before(:each) do
283
284
  @out = StringIO.new
284
285
  @error = StringIO.new
285
- @cli = CLI.new(@out, @error)
286
+ @cli = Main.new(@out, @error)
286
287
 
287
288
  mock_formatter_class = stub('formatter class')
288
289
  mock_formatter_class.stub!(:new).and_raise("No such method")
@@ -313,7 +314,7 @@ END_OF_MESSAGE
313
314
  before(:each) do
314
315
  @out = StringIO.new
315
316
  @error = StringIO.new
316
- @cli = CLI.new(@out, @error)
317
+ @cli = Main.new(@out, @error)
317
318
 
318
319
  @cli.parse_options!(%w{--format invalid})
319
320
  end
@@ -345,14 +346,14 @@ END_OF_MESSAGE
345
346
  end
346
347
 
347
348
  it "should accept multiple --scenario options" do
348
- cli = CLI.new
349
+ cli = Main.new
349
350
  cli.parse_options!(['--scenario', "User logs in", '--scenario', "User signs up"])
350
351
  cli.options[:scenario_names].should include("User logs in")
351
352
  cli.options[:scenario_names].should include("User signs up")
352
353
  end
353
354
 
354
355
  xit "should register --scenario options with the executor" do
355
- cli = CLI.new
356
+ cli = Main.new
356
357
  cli.parse_options!(['--scenario', "User logs in", '--scenario', "User signs up"])
357
358
  executor = mock_executor
358
359
  executor.should_receive(:scenario_names=).with(["User logs in", "User signs up"])
@@ -360,13 +361,13 @@ END_OF_MESSAGE
360
361
  end
361
362
 
362
363
  it "should accept --color option" do
363
- cli = CLI.new(StringIO.new)
364
+ cli = Main.new(StringIO.new)
364
365
  Term::ANSIColor.should_receive(:coloring=).with(true)
365
366
  cli.parse_options!(['--color'])
366
367
  end
367
368
 
368
369
  it "should accept --no-color option" do
369
- cli = CLI.new(StringIO.new)
370
+ cli = Main.new(StringIO.new)
370
371
  Term::ANSIColor.should_receive(:coloring=).with(false)
371
372
  cli.parse_options!(['--no-color'])
372
373
  end
@@ -377,7 +378,7 @@ END_OF_MESSAGE
377
378
  end
378
379
 
379
380
  it "should show full backtrace when --backtrace is present" do
380
- cli = CLI.new
381
+ cli = Main.new
381
382
  cli.parse_options!(['--backtrace'])
382
383
  begin
383
384
  "x".should == "y"
@@ -387,7 +388,7 @@ END_OF_MESSAGE
387
388
  end
388
389
 
389
390
  xit "should strip gems when --backtrace is absent" do
390
- cli = CLI.new
391
+ cli = Main.new
391
392
  cli.parse_options!(['--'])
392
393
  begin
393
394
  "x".should == "y"
@@ -402,7 +403,7 @@ END_OF_MESSAGE
402
403
  end
403
404
 
404
405
  it "should search for all features in the specified directory" do
405
- cli = CLI.new(StringIO.new)
406
+ cli = Main.new(StringIO.new)
406
407
 
407
408
  cli.parse_options!(%w{feature_directory/})
408
409
  File.stub!(:directory?).and_return(true)
@@ -414,3 +415,4 @@ END_OF_MESSAGE
414
415
 
415
416
  end
416
417
  end
418
+ 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.10
4
+ version: 0.1.99.11
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-26 00:00:00 -08:00
12
+ date: 2009-01-27 00:00:00 -08:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -61,7 +61,6 @@ extra_rdoc_files:
61
61
  - Manifest.txt
62
62
  - README.txt
63
63
  - examples/i18n/ja/README.txt
64
- - pretty.txt
65
64
  files:
66
65
  - History.txt
67
66
  - License.txt
@@ -240,7 +239,8 @@ files:
240
239
  - lib/cucumber/ast/tags.rb
241
240
  - lib/cucumber/ast/visitor.rb
242
241
  - lib/cucumber/broadcaster.rb
243
- - lib/cucumber/cli.rb
242
+ - lib/cucumber/cli/language_help_formatter.rb
243
+ - lib/cucumber/cli/main.rb
244
244
  - lib/cucumber/core_ext/exception.rb
245
245
  - lib/cucumber/core_ext/instance_exec.rb
246
246
  - lib/cucumber/core_ext/proc.rb
@@ -271,7 +271,6 @@ files:
271
271
  - lib/cucumber/step_definition.rb
272
272
  - lib/cucumber/step_mother.rb
273
273
  - lib/cucumber/version.rb
274
- - pretty.txt
275
274
  - rails_generators/cucumber/USAGE
276
275
  - rails_generators/cucumber/cucumber_generator.rb
277
276
  - rails_generators/cucumber/templates/cucumber
@@ -291,7 +290,7 @@ files:
291
290
  - spec/cucumber/ast/step_spec.rb
292
291
  - spec/cucumber/ast/table_spec.rb
293
292
  - spec/cucumber/broadcaster_spec.rb
294
- - spec/cucumber/cli_spec.rb
293
+ - spec/cucumber/cli/main_spec.rb
295
294
  - spec/cucumber/core_ext/proc_spec.rb
296
295
  - spec/cucumber/core_ext/string_spec.rb
297
296
  - spec/cucumber/formatter/ansicolor_spec.rb
data/pretty.txt DELETED
@@ -1,486 +0,0 @@
1
- Feature: Cucumber command line
2
- In order to write better software
3
- Developers should be able to execute requirements as tests
4
-
5
- Scenario: Run single scenario with missing step definition # features/cucumber_cli.feature:5
6
- When I run cucumber -q features/sample.feature:5 # features/step_definitions/cucumber_steps.rb:5
7
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
8
- """
9
- @one
10
- Feature: Sample
11
-
12
- @two @three
13
- Scenario: Missing
14
- Given missing
15
-
16
- 1 scenario
17
- 1 undefined step
18
-
19
- """
20
-
21
- Scenario: Fail with --strict # features/cucumber_cli.feature:21
22
- When I run cucumber -q features/sample.feature:5 --strict # features/step_definitions/cucumber_steps.rb:5
23
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
24
- """
25
- @one
26
- Feature: Sample
27
-
28
- @two @three
29
- Scenario: Missing
30
- Given missing
31
-
32
- 1 scenario
33
- 1 undefined step
34
-
35
- """
36
-
37
- Scenario: Specify 2 line numbers where one is a tag # features/cucumber_cli.feature:37
38
- When I run cucumber -q features/sample.feature:5:14 # features/step_definitions/cucumber_steps.rb:5
39
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
40
- """
41
- @one
42
- Feature: Sample
43
-
44
- @two @three
45
- Scenario: Missing
46
- Given missing
47
-
48
- @four
49
- Scenario: Failing
50
- Given failing
51
- FAIL (RuntimeError)
52
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
53
- ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
54
- features/sample.feature:16:in `Given failing'
55
-
56
- 2 scenarios
57
- 1 failed step
58
- 1 undefined step
59
-
60
- """
61
-
62
- Scenario: Require missing step definition from elsewhere # features/cucumber_cli.feature:62
63
- When I run cucumber -q -r ../../features/step_definitions/extra_steps.rb features/sample.feature:5 # features/step_definitions/cucumber_steps.rb:5
64
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
65
- """
66
- @one
67
- Feature: Sample
68
-
69
- @two @three
70
- Scenario: Missing
71
- Given missing
72
-
73
- 1 scenario
74
- 1 passed step
75
-
76
- """
77
-
78
- Scenario: Specify the line number of a row # features/cucumber_cli.feature:78
79
- When I run cucumber -q features/sample.feature:12 # features/step_definitions/cucumber_steps.rb:5
80
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
81
- """
82
- @one
83
- Feature: Sample
84
-
85
- @three
86
- Scenario: Passing
87
- Given passing
88
- | a | b |
89
- | c | d |
90
-
91
- 1 scenario
92
- 1 passed step
93
-
94
- """
95
-
96
- Scenario: Run all with progress formatter # features/cucumber_cli.feature:96
97
- When I run cucumber -q --format progress features/sample.feature # features/step_definitions/cucumber_steps.rb:5
98
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
99
- """
100
- U.F
101
-
102
- (::) failed steps (::)
103
-
104
- FAIL (RuntimeError)
105
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
106
- ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
107
- features/sample.feature:16:in `Given failing'
108
-
109
- 3 scenarios
110
- 1 failed step
111
- 1 undefined step
112
- 1 passed step
113
-
114
- """
115
-
116
- Scenario: Run Norwegian # features/cucumber_cli.feature:116
117
- Given I am in i18n/no # features/step_definitions/cucumber_steps.rb:1
118
- When I run cucumber -q --language no features # features/step_definitions/cucumber_steps.rb:5
119
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
120
- """
121
- Egenskap: Summering
122
- For å slippe å gjøre dumme feil
123
- Som en regnskapsfører
124
- Vil jeg kunne legge sammen
125
-
126
- Scenario: to tall
127
- Gitt at jeg har tastet inn 5
128
- Og at jeg har tastet inn 7
129
- Når jeg summerer
130
- Så skal resultatet være 12
131
-
132
- @iterasjon3
133
- Scenario: tre tall
134
- Gitt at jeg har tastet inn 5
135
- Og at jeg har tastet inn 7
136
- Og at jeg har tastet inn 1
137
- Når jeg summerer
138
- Så skal resultatet være 13
139
-
140
- 2 scenarios
141
- 9 passed steps
142
-
143
- """
144
-
145
- Scenario: --dry-run # features/cucumber_cli.feature:145
146
- When I run cucumber --dry-run --no-snippets features # features/step_definitions/cucumber_steps.rb:5
147
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
148
- """
149
- Feature: Calling undefined step
150
-
151
- Scenario: Call directly
152
- Given a step definition that calls an undefined step
153
-
154
- Scenario: Call via another
155
- Given call step "a step definition that calls an undefined step"
156
-
157
- Feature: Lots of undefined
158
-
159
- Scenario: Implement me
160
- Given it snows in Sahara
161
- Given it's 40 degrees in Norway
162
- And it's 40 degrees in Norway
163
- When I stop procrastinating
164
- And there is world peace
165
-
166
- Feature: Outline Sample
167
-
168
- Scenario: I have no steps
169
-
170
- Scenario Outline: Test state
171
- Given <state> without a table
172
- Given <other_state> without a table
173
-
174
- Examples:
175
- | state | other_state |
176
- | missing | passing |
177
- | passing | passing |
178
- | failing | passing |
179
-
180
- @one
181
- Feature: Sample
182
-
183
- @two @three
184
- Scenario: Missing
185
- Given missing
186
-
187
- @three
188
- Scenario: Passing
189
- Given passing
190
- | a | b |
191
- | c | d |
192
-
193
- @four
194
- Scenario: Failing
195
- Given failing
196
-
197
- 10 scenarios
198
- 9 skipped steps
199
- 7 undefined steps
200
-
201
- """
202
-
203
- Scenario: Multiple formatters and outputs # features/cucumber_cli.feature:203
204
- When I run cucumber --format progress --out tmp/progress.txt --format html --out tmp/features.html features # features/step_definitions/cucumber_steps.rb:5
205
- And examples/self_test/tmp/progress.txt should contain # features/step_definitions/cucumber_steps.rb:25
206
- """
207
- P.FP.F
208
-
209
- Pending Scenarios:
210
-
211
- 1) Outline Sample (Test state)
212
- 2) Sample (Missing)
213
-
214
-
215
- Failed:
216
-
217
- 1)
218
- FAIL
219
- ./features/step_definitions/sample_steps.rb:12:in ` /^failing without a table$/'
220
- features/outline_sample.feature:9:in `/^failing without a table$/'
221
-
222
- 2)
223
- FAIL
224
- ./features/step_definitions/sample_steps.rb:5:in `Given /^failing$/'
225
- features/sample.feature:12:in `Given failing'
226
-
227
- """
228
- No such file or directory - examples/self_test/tmp/progress.txt (Errno::ENOENT)
229
- ./features/step_definitions/cucumber_steps.rb:26:in `read'
230
- ./features/step_definitions/cucumber_steps.rb:26:in `/^(.*) should contain$/'
231
- features/cucumber_cli.feature:205:in `And examples/self_test/tmp/progress.txt should contain'
232
- And examples/self_test/tmp/features.html should match # features/step_definitions/cucumber_steps.rb:29
233
- """
234
- Given passing
235
- """
236
-
237
- Scenario: Run scenario specified by name using --scenario # features/cucumber_cli.feature:233
238
- When I run cucumber --scenario Passing -q features/sample.feature # features/step_definitions/cucumber_steps.rb:5
239
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
240
- """
241
- Feature: Sample
242
- Scenario: Passing
243
- Given passing
244
-
245
-
246
- 1 scenario
247
- 1 passed step
248
-
249
- """
250
- expected: "Feature: Sample\n Scenario: Passing\n Given passing\n\n\n1 scenario\n1 passed step\n",
251
- got: "@one\nFeature: Sample\n\n @two @three\n Scenario: Missing\n Given missing\n\n @three\n Scenario: Passing\n Given passing\n | a | b |\n | c | d |\n\n @four\n Scenario: Failing\n Given failing\n FAIL (RuntimeError)\n ./features/step_definitions/sample_steps.rb:2:in `flunker'\n ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'\n features/sample.feature:16:in `Given failing'\n\n3 scenarios\n1 failed step\n1 undefined step\n1 passed step\n" (using ==)
252
- Diff:
253
-
254
-
255
-
256
-
257
- @@ -1,8 +1,26 @@
258
- +@one
259
- Feature: Sample
260
- +
261
- + @two @three
262
- + Scenario: Missing
263
- + Given missing
264
- +
265
- + @three
266
- Scenario: Passing
267
- Given passing
268
- + | a | b |
269
- + | c | d |
270
-
271
- + @four
272
- + Scenario: Failing
273
- + Given failing
274
- + FAIL (RuntimeError)
275
- + ./features/step_definitions/sample_steps.rb:2:in `flunker'
276
- + ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
277
- + features/sample.feature:16:in `Given failing'
278
-
279
- -1 scenario
280
- +3 scenarios
281
- +1 failed step
282
- +1 undefined step
283
- 1 passed step
284
- (Spec::Expectations::ExpectationNotMetError)
285
- ./features/step_definitions/cucumber_steps.rb:17:in `/^it should (fail|pass) with$/'
286
- features/cucumber_cli.feature:235:in `Then it should pass with'
287
-
288
- Scenario: Run with a tag that exists on 2 scenarios # features/cucumber_cli.feature:247
289
- When I run cucumber -q features --tags three # features/step_definitions/cucumber_steps.rb:5
290
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
291
- """
292
- @one
293
- Feature: Sample
294
-
295
- @two @three
296
- Scenario: Missing
297
- Given missing
298
-
299
- @three
300
- Scenario: Passing
301
- Given passing
302
- | a | b |
303
- | c | d |
304
-
305
- 2 scenarios
306
- 1 undefined step
307
- 1 passed step
308
-
309
- """
310
-
311
- Scenario: Run with a tag that exists on 1 feature # features/cucumber_cli.feature:270
312
- When I run cucumber -q features --tags one # features/step_definitions/cucumber_steps.rb:5
313
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
314
- """
315
- @one
316
- Feature: Sample
317
-
318
- @two @three
319
- Scenario: Missing
320
- Given missing
321
-
322
- @three
323
- Scenario: Passing
324
- Given passing
325
- | a | b |
326
- | c | d |
327
-
328
- @four
329
- Scenario: Failing
330
- Given failing
331
- FAIL (RuntimeError)
332
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
333
- ./features/step_definitions/sample_steps.rb:9:in `/^failing$/'
334
- features/sample.feature:16:in `Given failing'
335
-
336
- 3 scenarios
337
- 1 failed step
338
- 1 undefined step
339
- 1 passed step
340
-
341
- """
342
-
343
- Scenario: Reformat files with --autoformat # features/cucumber_cli.feature:302
344
- When I run cucumber --autoformat tmp/formatted features # features/step_definitions/cucumber_steps.rb:5
345
- Then examples/self_test/tmp/formatted/features/sample.feature should contain # features/step_definitions/cucumber_steps.rb:25
346
- """
347
- @one
348
- Feature: Sample
349
-
350
- @two @three
351
- Scenario: Missing
352
- Given missing
353
-
354
- @three
355
- Scenario: Passing
356
- Given passing
357
- | a | b |
358
- | c | d |
359
-
360
- @four
361
- Scenario: Failing
362
- Given failing
363
-
364
-
365
- """
366
- No such file or directory - examples/self_test/tmp/formatted/features/sample.feature (Errno::ENOENT)
367
- ./features/step_definitions/cucumber_steps.rb:26:in `read'
368
- ./features/step_definitions/cucumber_steps.rb:26:in `/^(.*) should contain$/'
369
- features/cucumber_cli.feature:304:in `Then examples/self_test/tmp/formatted/features/sample.feature should contain'
370
-
371
- Feature: Cucumber command line
372
- In order to write better software
373
- Developers should be able to execute requirements as tests
374
-
375
- Scenario: Run scenario outline steps only # features/cucumber_cli_outlines.feature:5
376
- When I run cucumber -q features/outline_sample.feature:7 # features/step_definitions/cucumber_steps.rb:5
377
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
378
- """
379
- Feature: Outline Sample
380
-
381
- Scenario Outline: Test state
382
- Given <state> without a table
383
- Given <other_state> without a table
384
-
385
- Examples:
386
- | state | other_state |
387
- | missing | passing |
388
- | passing | passing |
389
- | failing | passing |
390
- FAIL (RuntimeError)
391
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
392
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
393
- features/outline_sample.feature:12:in `Given failing without a table'
394
-
395
- 3 scenarios
396
- 1 failed step
397
- 2 skipped steps
398
- 1 undefined step
399
- 2 passed steps
400
-
401
- """
402
-
403
- Scenario: Run single failing scenario outline table row # features/cucumber_cli_outlines.feature:33
404
- When I run cucumber features/outline_sample.feature:12 # features/step_definitions/cucumber_steps.rb:5
405
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
406
- """
407
- Feature: Outline Sample
408
-
409
- Scenario Outline: Test state # features/outline_sample.feature:5
410
- Given <state> without a table
411
- Given <other_state> without a table
412
-
413
- Examples:
414
- | state | other_state |
415
- | failing | passing |
416
- FAIL (RuntimeError)
417
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
418
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
419
- features/outline_sample.feature:12:in `Given failing without a table'
420
-
421
- 1 scenario
422
- 1 failed step
423
- 1 skipped step
424
-
425
- """
426
-
427
- Scenario: Run all with progress formatter # features/cucumber_cli_outlines.feature:57
428
- When I run cucumber -q --format progress features/outline_sample.feature # features/step_definitions/cucumber_steps.rb:5
429
- Then it should fail with # features/step_definitions/cucumber_steps.rb:15
430
- """
431
- UUS..FS
432
-
433
- (::) undefined scenarios (::)
434
-
435
- features/outline_sample.feature:3:in `Scenario: I have no steps'
436
-
437
- (::) failed steps (::)
438
-
439
- FAIL (RuntimeError)
440
- ./features/step_definitions/sample_steps.rb:2:in `flunker'
441
- ./features/step_definitions/sample_steps.rb:16:in `/^failing without a table$/'
442
- features/outline_sample.feature:12:in `Given failing without a table'
443
-
444
- 4 scenarios
445
- 1 failed step
446
- 2 skipped steps
447
- 1 undefined step
448
- 2 passed steps
449
-
450
- """
451
-
452
- Feature: Cucumber command line
453
- In order to find out what step definitions need to be implemented
454
- Developers should always see what step definition is missing
455
-
456
- Scenario: Get info at arbitrary levels of nesting # features/report_called_undefined_steps.feature:5
457
- When I run cucumber features/call_undefined_step_from_step_def.feature # features/step_definitions/cucumber_steps.rb:5
458
- Then it should pass with # features/step_definitions/cucumber_steps.rb:15
459
- """
460
- Feature: Calling undefined step
461
-
462
- Scenario: Call directly # features/call_undefined_step_from_step_def.feature:3
463
- Given a step definition that calls an undefined step # features/step_definitions/sample_steps.rb:19
464
- Undefined step: "this does not exist" (Cucumber::StepMother::Undefined)
465
- ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
466
-
467
- Scenario: Call via another # features/call_undefined_step_from_step_def.feature:6
468
- Given call step "a step definition that calls an undefined step" # features/step_definitions/sample_steps.rb:23
469
- Undefined step: "this does not exist" (Cucumber::StepMother::Undefined)
470
- ./features/step_definitions/sample_steps.rb:20:in `/^a step definition that calls an undefined step$/'
471
-
472
- 2 scenarios
473
- 2 undefined steps
474
-
475
- You can implement step definitions for missing steps with these snippets:
476
-
477
- Given /^this does not exist$/ do
478
- end
479
-
480
-
481
- """
482
-
483
- 17 scenarios
484
- 3 failed steps
485
- 1 skipped step
486
- 32 passed steps