aslakhellesoy-cucumber 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,13 @@
1
+ == 0.3.3 (In Git)
2
+
3
+ === Bugfixes
4
+ * Summaries are no longer printed in an empty () if there are no scenarios/steps (Aslak Hellesøy)
5
+ * Background, Scenario Outline, Before Hook interaction (#309 Aslak Hellesøy)
6
+ * Multiline String snippets no longer give misleading info. It's a String, not a PyString that's sent to step def.
7
+
8
+ === Removed/changed features
9
+ * New aliases: --no-source/-s, --name/-n (#317 Lonnon Foster)
10
+
1
11
  == 0.3.2 2009-05-05
2
12
 
3
13
  This release has some minor bug fixes and new features.
@@ -158,11 +158,13 @@ examples/selenium/features/search.feature
158
158
  examples/selenium/features/step_definitons/search_steps.rb
159
159
  examples/selenium/features/support/env.rb
160
160
  examples/selenium_webrat/Rakefile
161
+ examples/selenium_webrat/config.ru
161
162
  examples/selenium_webrat/features/search.feature
162
163
  examples/selenium_webrat/features/step_definitons/search_steps.rb
163
164
  examples/selenium_webrat/features/support/env.rb
164
165
  examples/self_test/README.textile
165
166
  examples/self_test/Rakefile
167
+ examples/self_test/features/background/background_tagged_before_on_outline.feature
166
168
  examples/self_test/features/background/background_with_name.feature
167
169
  examples/self_test/features/background/failing_background.feature
168
170
  examples/self_test/features/background/failing_background_after_success.feature
@@ -6,4 +6,4 @@ Feature: Search
6
6
  Scenario: Find what I'm looking for
7
7
  Given I am on the Google search page
8
8
  When I search for "rspec"
9
- Then I should see a link to http://rspec.info/
9
+ Then I should see a link to RSpec-1.2.4: Home
@@ -4,10 +4,10 @@ end
4
4
 
5
5
  When /I search for "(.*)"/ do |query|
6
6
  fill_in('q', :with => query)
7
- click_button('btnG')
7
+ click_button 'Google Search'
8
8
  selenium.wait_for_page_to_load
9
9
  end
10
10
 
11
11
  Then /I should see a link to (.*)/ do |expected_url|
12
- click_link(expected_url)
12
+ click_link expected_url
13
13
  end
@@ -17,6 +17,7 @@ require 'spec/expectations'
17
17
 
18
18
  # Webrat
19
19
  require 'webrat'
20
+
20
21
  Webrat.configure do |config|
21
22
  config.mode = :selenium
22
23
  end
@@ -31,11 +32,14 @@ end
31
32
 
32
33
  # START HACK
33
34
  # Disable Rails-specific code
34
- module Webrat
35
- def self.start_app_server
35
+ class Webrat::Selenium::ApplicationServer
36
+ def self.boot
37
+
38
+ STDOUT.puts "Starting app server"
36
39
  end
37
40
 
38
- def self.stop_app_server
41
+ def self.stop_at_exit
42
+ STDOUT.puts "Stopping app server"
39
43
  end
40
44
  end
41
45
  # END HACK
@@ -1,7 +1,7 @@
1
1
  Feature: search examples
2
2
 
3
- Background: Hantu Pisang background match
4
- Given passing without a table
3
+ Background: Hantu Pisang background match
4
+ Given passing without a table
5
5
 
6
6
  Scenario: should match Hantu Pisang
7
7
  Given passing without a table
@@ -12,21 +12,21 @@ Feature: search examples
12
12
  Scenario Outline: Ignore me
13
13
  Given <state> without a table
14
14
  Examples:
15
- |state|
16
- |failing|
15
+ | state |
16
+ | failing |
17
17
 
18
18
  Scenario Outline: Hantu Pisang match
19
19
  Given <state> without a table
20
20
  Examples:
21
- |state|
22
- |passing|
21
+ | state |
22
+ | passing |
23
23
 
24
24
  Scenario Outline: no match in name but in examples
25
25
  Given <state> without a table
26
26
  Examples: Hantu Pisang
27
- |state|
28
- |passing|
27
+ | state |
28
+ | passing |
29
29
 
30
30
  Examples: Ignore me
31
- |state|
32
- |failing|
31
+ | state |
32
+ | failing |
@@ -1 +1,17 @@
1
- require 'spec/expectations'
1
+ require 'spec/expectations'
2
+
3
+ Before('@not_used') do
4
+ raise "Should never run"
5
+ end
6
+
7
+ After('@not_used') do
8
+ raise "Should never run"
9
+ end
10
+
11
+ Before('@background_tagged_before_on_outline') do
12
+ @cukes = '888'
13
+ end
14
+
15
+ After('@background_tagged_before_on_outline') do
16
+ @cukes.should == '888'
17
+ end
@@ -10,7 +10,7 @@ Cucumber::Rake::Task.new(:html) do |t|
10
10
  end
11
11
 
12
12
  Cucumber::Rake::Task.new(:progress) do |t|
13
- t.cucumber_opts = "--tags ~@intentional_failure --format progress -i -n"
13
+ t.cucumber_opts = "--tags ~@intentional_failure --format progress -i -s"
14
14
  end
15
15
 
16
16
  task :default => [:pretty, :html, :progress]
@@ -68,6 +68,28 @@ Feature: backgrounds
68
68
 
69
69
  """
70
70
 
71
+ Scenario: run a feature with scenario outlines that has a background that passes
72
+ When I run cucumber -q features/background/background_tagged_before_on_outline.feature --require features
73
+ Then it should pass with
74
+ """
75
+ @background_tagged_before_on_outline
76
+ Feature: Background tagged Before on Outline
77
+
78
+ Background:
79
+ Given passing without a table
80
+
81
+ Scenario Outline: passing background
82
+ Then I should have '<count>' cukes
83
+
84
+ Examples:
85
+ | count |
86
+ | 888 |
87
+
88
+ 1 scenario (1 passed)
89
+ 2 steps (2 passed)
90
+
91
+ """
92
+
71
93
  Scenario: run a feature with a background that fails
72
94
  When I run cucumber -q features/background/failing_background.feature --require features
73
95
  Then it should fail with
@@ -367,7 +367,7 @@ Feature: Cucumber command line
367
367
 
368
368
  """
369
369
 
370
- Scenario: Run a single background which matches a name using --name
370
+ Scenario: Run a single background which matches a name using --name (Useful if there is an error in it)
371
371
  When I run cucumber --name 'Hantu Pisang background' -q features/
372
372
  Then it should pass with
373
373
  """
@@ -376,7 +376,7 @@ Feature: Cucumber command line
376
376
  Background: Hantu Pisang background match
377
377
  Given passing without a table
378
378
 
379
- 0 scenarios ()
379
+ 0 scenarios
380
380
  1 step (1 passed)
381
381
 
382
382
  """
@@ -486,3 +486,33 @@ Feature: Cucumber command line
486
486
 
487
487
  """
488
488
 
489
+ Scenario: Run feature elements which match a name using -n
490
+ When I run cucumber -n Pisang -q features/
491
+ Then it should pass with
492
+ """
493
+ Feature: search examples
494
+
495
+ Background: Hantu Pisang background match
496
+ Given passing without a table
497
+
498
+ Scenario: should match Hantu Pisang
499
+ Given passing without a table
500
+
501
+ Scenario Outline: Hantu Pisang match
502
+ Given <state> without a table
503
+
504
+ Examples:
505
+ | state |
506
+ | passing |
507
+
508
+ Scenario Outline: no match in name but in examples
509
+ Given <state> without a table
510
+
511
+ Examples: Hantu Pisang
512
+ | state |
513
+ | passing |
514
+
515
+ 3 scenarios (3 passed)
516
+ 6 steps (6 passed)
517
+
518
+ """
@@ -4,8 +4,8 @@ Feature: Custom Formatter
4
4
  When I run cucumber --format Tag::Count features
5
5
  Then it should fail with
6
6
  """
7
- | after_file | four | lots | one | three | two |
8
- | 1 | 1 | 1 | 1 | 2 | 1 |
7
+ | after_file | background_tagged_before_on_outline | four | lots | one | three | two |
8
+ | 1 | 1 | 1 | 1 | 1 | 2 | 1 |
9
9
 
10
10
  """
11
11
 
@@ -4,16 +4,15 @@ Feature: Snippets
4
4
  I want snippet suggestions for undefined step definitions
5
5
 
6
6
  Scenario: Snippet for undefined step with a pystring
7
- When I run cucumber features/undefined_multiline_args.feature:3 -n
7
+ When I run cucumber features/undefined_multiline_args.feature:3 -s
8
8
  Then the output should contain
9
9
  """
10
10
  Given /^a pystring$/ do |string|
11
- # string is a Cucumber::Ast::PyString
12
11
  pending
13
12
  end
14
13
  """
15
14
  Scenario: Snippet for undefined step with a step table
16
- When I run cucumber features/undefined_multiline_args.feature:9 -n
15
+ When I run cucumber features/undefined_multiline_args.feature:9 -s
17
16
  Then the output should contain
18
17
  """
19
18
  Given /^a table$/ do |table|
@@ -8,6 +8,7 @@ Feature: Cucumber command line
8
8
  Then it should pass with
9
9
  """
10
10
  /^passing without a table$/ # features/step_definitions/sample_steps.rb:12
11
+ Given passing without a table # features/background/background_tagged_before_on_outline.feature:5
11
12
  Given passing without a table # features/background/failing_background_after_success.feature:4
12
13
  Given passing without a table # features/multiline_name.feature:6
13
14
  Given passing without a table # features/multiline_name.feature:11
@@ -83,6 +84,7 @@ Feature: Cucumber command line
83
84
  Given '2' cukes # features/tons_of_cukes.feature:51
84
85
  Given '2' cukes # features/tons_of_cukes.feature:52
85
86
  /^I should have '(.+)' cukes$/ # features/step_definitions/sample_steps.rb:31
87
+ Then I should have '<count>' cukes # features/background/background_tagged_before_on_outline.feature:8
86
88
  Then I should have '10' cukes # features/background/background_with_name.feature:7
87
89
  Then I should have '10' cukes # features/background/failing_background.feature:9
88
90
  Then I should have '10' cukes # features/background/failing_background.feature:12
@@ -32,7 +32,12 @@ module Cucumber
32
32
  end
33
33
 
34
34
  def accept_hook?(hook)
35
- false
35
+ if hook_context != self
36
+ hook_context.accept_hook?(hook)
37
+ else
38
+ # We have no scenarios
39
+ false
40
+ end
36
41
  end
37
42
 
38
43
  def failed?
@@ -23,6 +23,8 @@ module Cucumber
23
23
  examples_table = OutlineTable.new(examples_matrix, self)
24
24
  Examples.new(examples_line, examples_keyword, examples_name, examples_table)
25
25
  end
26
+
27
+ @background.feature_elements << self if @background
26
28
  end
27
29
 
28
30
  def accept(visitor)
@@ -28,7 +28,7 @@ module Cucumber
28
28
  "Examples:",
29
29
  "cucumber examples/i18n/en/features",
30
30
  "cucumber --language it examples/i18n/it/features/somma.feature:6:98:113",
31
- "cucumber -n -i http://rubyurl.com/eeCl", "", "",
31
+ "cucumber -s -i http://rubyurl.com/eeCl", "", "",
32
32
  ].join("\n")
33
33
  opts.on("-r LIBRARY|DIR", "--require LIBRARY|DIR",
34
34
  "Require files before executing the features. If this",
@@ -78,7 +78,7 @@ module Cucumber
78
78
  "with or without the @ prefix.") do |v|
79
79
  @options[:include_tags], @options[:exclude_tags] = *parse_tags(v)
80
80
  end
81
- opts.on("-n NAME", "--name NAME",
81
+ opts.on("-n NAME", "--name NAME",
82
82
  "Only execute the feature elements which match part of the given name.",
83
83
  "If this option is given more than once, it will match against all the",
84
84
  "given names.") do |v|
@@ -114,7 +114,7 @@ module Cucumber
114
114
  "Don't print multiline strings and tables under steps.") do
115
115
  @options[:no_multiline] = true
116
116
  end
117
- opts.on("-n", "--no-source",
117
+ opts.on("-s", "--no-source",
118
118
  "Don't print the file and line of the step definition with the steps.") do
119
119
  @options[:source] = false
120
120
  end
@@ -97,8 +97,12 @@ module Cucumber
97
97
  counts = [:failed, :skipped, :undefined, :pending, :passed].map do |status|
98
98
  elements = yield status
99
99
  elements.any? ? format_string("#{elements.length} #{status.to_s}", status) : nil
100
+ end.compact
101
+ if counts.any?
102
+ @io.puts(" (#{counts.join(', ')})")
103
+ else
104
+ @io.puts
100
105
  end
101
- @io.puts(" (#{counts.compact.join(', ')})")
102
106
  end
103
107
 
104
108
  def dump_count(count, what, state=nil)
@@ -70,9 +70,12 @@ module Cucumber
70
70
  end
71
71
  block_args << multiline_arg_class.default_arg_name unless multiline_arg_class.nil?
72
72
  block_arg_string = block_args.empty? ? "" : " |#{block_args.join(", ")}|"
73
- multiline_class_string = multiline_arg_class ? "# #{multiline_arg_class.default_arg_name} is a #{multiline_arg_class.to_s}\n " : ""
73
+ multiline_class_comment = ""
74
+ if(multiline_arg_class == Ast::Table)
75
+ multiline_class_comment = "# #{multiline_arg_class.default_arg_name} is a #{multiline_arg_class.to_s}\n "
76
+ end
74
77
 
75
- "#{step_keyword} /^#{escaped}$/ do#{block_arg_string}\n #{multiline_class_string}pending\nend"
78
+ "#{step_keyword} /^#{escaped}$/ do#{block_arg_string}\n #{multiline_class_comment}pending\nend"
76
79
  end
77
80
 
78
81
  class MissingProc < StandardError
@@ -3,7 +3,7 @@ module Cucumber #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
5
  TINY = 2
6
- PATCH = nil # Set to nil for official release
6
+ PATCH = 1 # Set to nil for official release
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY, PATCH].compact.join('.')
9
9
  end
@@ -107,19 +107,19 @@ Then /^I should not see "([^\"]*)"$/ do |text|
107
107
  end
108
108
 
109
109
  Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
110
- <% if framework == :rspec -%>
111
- field_labeled(field).value.should =~ /#{value}/
112
- <% else -%>
113
- assert_match(/#{value}/, field_labeled(field).value)
114
- <% end -%>
110
+ <% if framework == :rspec -%>
111
+ field_labeled(field).value.should =~ /#{value}/
112
+ <% else -%>
113
+ assert_match(/#{value}/, field_labeled(field).value)
114
+ <% end -%>
115
115
  end
116
116
 
117
117
  Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
118
- <% if framework == :rspec -%>
119
- field_labeled(field).value.should_not =~ /#{value}/
120
- <% else -%>
121
- assert_no_match(/#{value}/, field_labeled(field).value)
122
- <% end -%>
118
+ <% if framework == :rspec -%>
119
+ field_labeled(field).value.should_not =~ /#{value}/
120
+ <% else -%>
121
+ assert_no_match(/#{value}/, field_labeled(field).value)
122
+ <% end -%>
123
123
  end
124
124
 
125
125
  Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
@@ -263,9 +263,18 @@ END_OF_MESSAGE
263
263
  config.options[:name_regexps].should include(/User signs up/)
264
264
  end
265
265
 
266
+ it "should accept multiple -n options" do
267
+ config = Configuration.new
268
+ config.parse!(['-n', "User logs in", '-n', "User signs up"])
269
+
270
+ config.options[:name_regexps].should include(/User logs in/)
271
+ config.options[:name_regexps].should include(/User signs up/)
272
+ end
273
+
266
274
  it "should search for all features in the specified directory" do
267
275
  File.stub!(:directory?).and_return(true)
268
- Dir.should_receive(:[]).with("feature_directory/**/*.feature").any_number_of_times.and_return(["cucumber.feature"])
276
+ Dir.should_receive(:[]).with("feature_directory/**/*.feature").
277
+ any_number_of_times.and_return(["cucumber.feature"])
269
278
 
270
279
  config = Configuration.new(StringIO)
271
280
  config.parse!(%w{feature_directory/})
@@ -313,7 +313,7 @@ Given I am a step
313
313
  }).to_sexp.should ==
314
314
  [:feature, nil, "Feature: Hi",
315
315
  [:scenario, 2, "Scenario:", "When I have when in scenario",
316
- [:step, 3, "Given", "I am a step"]]]
316
+ [:step_invocation, 3, "Given", "I am a step"]]]
317
317
  end
318
318
  end
319
319
  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.3.2
4
+ version: 0.3.3
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-05-03 00:00:00 -07:00
12
+ date: 2009-05-04 00:00:00 -07:00
13
13
  default_executable: cucumber
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -473,7 +473,7 @@ requirements: []
473
473
  rubyforge_project: rspec
474
474
  rubygems_version: 1.2.0
475
475
  signing_key:
476
- specification_version: 2
476
+ specification_version: 3
477
477
  summary: Executable Feature scenarios
478
478
  test_files: []
479
479