1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
Feature: Assertions
In order to get started quickly
As a new Cucumber user
I want to use a familiar assertion library
Background:
Given a file named "features/assert.feature" with:
"""
Feature: Assert
Scenario: Passing
Then it should pass
"""
Given a file named "without_rspec.rb" with:
"""
require 'rubygems' if RUBY_VERSION <= '1.8.7'
require 'rspec/expectations'
module RSpec
remove_const :Matchers rescue nil
remove_const :Expectations rescue nil
end
module Spec
remove_const :Expectations rescue nil
end
"""
@spawn
Scenario: Test::Unit
Given a file named "features/step_definitions/assert_steps.rb" with:
"""
require 'test/unit/assertions'
World(::Test::Unit::Assertions)
Then /^it should pass$/ do
assert(2 + 2 == 4)
end
"""
When I run `cucumber`
Then it should pass with exactly:
"""
Feature: Assert
Scenario: Passing # features/assert.feature:2
Then it should pass # features/step_definitions/assert_steps.rb:4
1 scenario (1 passed)
1 step (1 passed)
0m0.012s
"""
Scenario: RSpec
Given a file named "features/step_definitions/assert_steps.rb" with:
"""
Then /^it should pass$/ do
(2 + 2).should == 4
end
"""
When I run `cucumber`
Then it should pass with exactly:
"""
Feature: Assert
Scenario: Passing # features/assert.feature:2
Then it should pass # features/step_definitions/assert_steps.rb:1
1 scenario (1 passed)
1 step (1 passed)
0m0.012s
"""
|