Skip to content

Commit

Permalink
Merged from master
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakhellesoy committed May 20, 2009
2 parents 8541d49 + c0f3493 commit 6954e3c
Show file tree
Hide file tree
Showing 22 changed files with 527 additions and 28 deletions.
20 changes: 17 additions & 3 deletions History.txt
@@ -1,13 +1,27 @@
== 0.3.6 (In Git)
== 0.3.7 (In Git)

With this release you can package your formatters in RubyGems.
=== New Features
* New --expand option. This will print Scenario Outlines once for each Example row - with values expanded. (Aslak Hellesøy)
* You can override the formatter in Rails-generated rake tasks with the CUCUMBER_FORMAT environment variable (#335 Aslak Hellesøy)

== 0.3.6 2009-05-20

Kanban! With this release you can tag features or scenarios that are work in progress
with a tag and use the new --wip switch.

Another handy feature in this release is that you can package your own formatters in RubyGems.

=== New features
* New --expand option. This will print Scenario Outlines once for each Example row - with values expanded. (Aslak Hellesøy)
* New --wip switch. See http://www.jroller.com/perryn/entry/bdd_on_a_multi_disciplined (Perryn Fowler)
* Added a AfterStep hook (Luke Melia)
* New aliases for Vietnamese (Ngoc Dao)
* Automatic require of custom formatters. --require is no longer needed to load them, and they can be in Ruby gems. (Aslak Hellesøy)
* Lazy loading of built-in formatters. Should improve startup time a little bit.

=== Bugfixes
* Gracefully handle exceptions in After block (#330 Matt Wynne)
* Feature with only Background doesn't run hooks (#314, #329 Aslak Hellesøy)

== 0.3.5 2009-05-14

Let's make a new release today because two annoying bugs are fixed.
Expand Down
3 changes: 3 additions & 0 deletions Manifest.txt
Expand Up @@ -237,6 +237,8 @@ examples/watir/Rakefile
examples/watir/features/search.feature
examples/watir/features/step_definitons/search_steps.rb
examples/watir/features/support/env.rb
features/after_block_exceptions.feature
features/after_step_block_exceptions.feature
features/background.feature
features/cucumber_cli.feature
features/cucumber_cli_diff_disabled.feature
Expand All @@ -253,6 +255,7 @@ features/step_definitions/cucumber_steps.rb
features/step_definitions/extra_steps.rb
features/support/env.rb
features/usage.feature
features/work_in_progress.feature
gem_tasks/deployment.rake
gem_tasks/environment.rake
gem_tasks/features.rake
Expand Down
6 changes: 3 additions & 3 deletions cucumber.gemspec

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions features/after_block_exceptions.feature
@@ -0,0 +1,97 @@
Feature: After Block Exceptions
In order to use custom assertions at the end of each scenario
As a developer
I want exceptions raised in After blocks to be handled gracefully and reported by the formatters

Background:
Given a standard Cucumber project directory structure
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^this step does something naughty$/ do
@naughty = true
end
Given /^this step works$/ do
end
"""
And a file named "features/support/env.rb" with:
"""
class NaughtyScenarioException < Exception; end
After do
if @naughty
raise NaughtyScenarioException.new("This scenario has been very very naughty")
end
end
"""

Scenario: Handle Exception in standard scenario step and carry on
Given a file named "features/naughty_step_in_scenario.feature" with:
"""
Feature: Sample
Scenario: Naughty Step
Given this step does something naughty
Scenario: Success
Given this step works
"""
When I run cucumber features
Then it should fail with
"""
Feature: Sample
Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
Given this step does something naughty # features/step_definitions/steps.rb:1
This scenario has been very very naughty (NaughtyScenarioException)
./features/support/env.rb:4:in `After'
Scenario: Success # features/naughty_step_in_scenario.feature:6
Given this step works # features/step_definitions/steps.rb:5
2 scenarios (1 failed, 1 passed)
2 steps (2 passed)
"""

Scenario: Handle Exception in scenario outline table row and carry on
Given a file named "features/naughty_step_in_scenario_outline.feature" with:
"""
Feature: Sample
Scenario Outline: Naughty Step
Given this step <Might Work>
Examples:
| Might Work |
| works |
| does something naughty |
| works |
Scenario: Success
Given this step works
"""
When I run cucumber features
Then it should fail with
"""
Feature: Sample
Scenario Outline: Naughty Step # features/naughty_step_in_scenario_outline.feature:3
Given this step <Might Work> # features/step_definitions/steps.rb:5
Examples:
| Might Work |
| works |
| does something naughty |
This scenario has been very very naughty (NaughtyScenarioException)
./features/support/env.rb:4:in `After'
| works |
Scenario: Success # features/naughty_step_in_scenario_outline.feature:12
Given this step works # features/step_definitions/steps.rb:5
4 scenarios (1 failed, 3 passed)
4 steps (4 passed)
"""

99 changes: 99 additions & 0 deletions features/after_step_block_exceptions.feature
@@ -0,0 +1,99 @@
Feature: AfterStep Block Exceptions
In order to use custom assertions at the end of each step
As a developer
I want exceptions raised in AfterStep blocks to be handled gracefully and reported by the formatters

Background:
Given a standard Cucumber project directory structure
And a file named "features/step_definitions/steps.rb" with:
"""
Given /^this step does something naughty$/ do
@naughty = true
end
Given /^this step works$/ do
end
"""
And a file named "features/support/env.rb" with:
"""
class NaughtyStepException < Exception; end
AfterStep do
if @naughty
raise NaughtyStepException.new("This step has been very very naughty")
end
end
"""

Scenario: Handle Exception in standard scenario step and carry on
Given a file named "features/naughty_step_in_scenario.feature" with:
"""
Feature: Sample
Scenario: Naughty Step
Given this step does something naughty
Scenario: Success
Given this step works
"""
When I run cucumber features
Then it should fail with
"""
Feature: Sample
Scenario: Naughty Step # features/naughty_step_in_scenario.feature:3
Given this step does something naughty # features/step_definitions/steps.rb:1
This step has been very very naughty (NaughtyStepException)
./features/support/env.rb:4:in `AfterStep'
features/naughty_step_in_scenario.feature:4:in `Given this step does something naughty'
Scenario: Success # features/naughty_step_in_scenario.feature:6
Given this step works # features/step_definitions/steps.rb:5
2 scenarios (1 failed, 1 passed)
2 steps (1 failed, 1 passed)
"""

Scenario: Handle Exception in scenario outline table row and carry on
Given a file named "features/naughty_step_in_scenario_outline.feature" with:
"""
Feature: Sample
Scenario Outline: Naughty Step
Given this step <Might Work>
Examples:
| Might Work |
| works |
| does something naughty |
| works |
Scenario: Success
Given this step works
"""
When I run cucumber features
Then it should fail with
"""
Feature: Sample
Scenario Outline: Naughty Step # features/naughty_step_in_scenario_outline.feature:3
Given this step <Might Work> # features/step_definitions/steps.rb:5
Examples:
| Might Work |
| works |
| does something naughty |
This step has been very very naughty (NaughtyStepException)
./features/support/env.rb:4:in `AfterStep'
features/naughty_step_in_scenario_outline.feature:4:in `Given this step <Might Work>'
| works |
Scenario: Success # features/naughty_step_in_scenario_outline.feature:12
Given this step works # features/step_definitions/steps.rb:5
4 scenarios (1 failed, 3 passed)
4 steps (1 failed, 3 passed)
"""

49 changes: 47 additions & 2 deletions features/background.feature
Expand Up @@ -253,5 +253,50 @@ Feature: backgrounds
"""

@josephwilk
Scenario: run a scenario showing explicit background steps --explicit-background
Scenario: https://rspec.lighthouseapp.com/projects/16211/tickets/329
Given a standard Cucumber project directory structure
And a file named "features/only_background_and_hooks.feature" with:
"""
Feature: woo yeah
Background:
Given whatever
"""
And a file named "features/only_background_and_hooks_steps.rb" with:
"""
require 'spec/expectations'
Before do
$before = true
end
After do
$after = true
end
Given /^whatever$/ do
$before.should == true
$step = true
end
at_exit do
$before.should == true
$step.should == true
$after.should == true
end
"""
When I run cucumber features/only_background_and_hooks.feature
Then it should pass
And the output should be
"""
Feature: woo yeah
Background: # features/only_background_and_hooks.feature:3
Given whatever # features/only_background_and_hooks_steps.rb:11
0 scenarios
1 step (1 passed)
"""
And STDERR should be empty
8 changes: 8 additions & 0 deletions features/step_definitions/cucumber_steps.rb
Expand Up @@ -62,6 +62,10 @@
last_stdout.should_not include(text)
end

Then /^the output should be$/ do |text|
last_stdout.should == text
end

# http://diffxml.sourceforge.net/
Then /^"(.*)" should contain XML$/ do |file, xml|
t = Tempfile.new('cucumber-junit')
Expand All @@ -86,6 +90,10 @@
last_stderr.should =~ /#{text}/
end

Then /^STDERR should be empty$/ do
last_stderr.should == ""
end

Then /^"(.*)" should exist$/ do |file|
File.exists?(file).should be_true
FileUtils.rm(file)
Expand Down

0 comments on commit 6954e3c

Please sign in to comment.