Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

require 'rspec/expectations' in cucumber features

  • Loading branch information...
commit 768c72b33d35dfaeae811cf1a195f32d39239600 1 parent 5f71a4b
@dchelimsky dchelimsky authored
View
10 features-pending/formatters/custom_formatter.feature
@@ -7,7 +7,9 @@ Feature: custom formatters
Scenario: specdoc format
Given a file named "custom_formatter.rb" with:
"""
- require 'spec/runner/formatter/base_formatter'
+ require "rspec/expectations"
+ require "spec/runner/formatter/base_formatter"
+
class CustomFormatter < Spec::Runner::Formatter::BaseFormatter
def initialize(options, output)
@output = output
@@ -18,13 +20,13 @@ Feature: custom formatters
end
"""
And a file named "simple_example_spec.rb" with:
- """
+ """
describe "my group" do
specify "my example" do
end
end
- """
+ """
- When I run "spec simple_example_spec.rb --require custom_formatter.rb --format CustomFormatter"
+ When I run "rspec simple_example_spec.rb --require custom_formatter.rb --format CustomFormatter"
Then the exit code should be 0
And the stdout should match "example: my example"
View
8 features/command_line/line_number_option.feature
@@ -6,6 +6,8 @@ Feature: line number option
Scenario: standard examples
Given a file named "example_spec.rb" with:
"""
+ require "rspec/expectations"
+
describe 9 do
it "should be > 8" do
@@ -18,7 +20,7 @@ Feature: line number option
end
"""
- When I run "spec example_spec.rb --line 3 --format doc"
+ When I run "spec example_spec.rb --line 5 --format doc"
Then the stdout should match "1 example, 0 failures"
Then the stdout should match "should be > 8"
But the stdout should not match "should be < 10"
@@ -26,6 +28,8 @@ Feature: line number option
Scenario: one liner
Given a file named "example_spec.rb" with:
"""
+ require "rspec/expectations"
+
describe 9 do
it { should be > 8 }
@@ -34,7 +38,7 @@ Feature: line number option
end
"""
- When I run "spec example_spec.rb --line 3 --format doc"
+ When I run "spec example_spec.rb --line 5 --format doc"
Then the stdout should match "1 example, 0 failures"
Then the stdout should match "should be > 8"
But the stdout should not match "should be < 10"
View
16 features/configuration/spec_opts.feature
@@ -13,9 +13,8 @@ Feature: spec/spec.opts
Scenario: color set in Rspec.configure
Given a file named "spec/spec_helper.rb" with:
"""
- Rspec.configure do |c|
- c.color_enabled = true
- end
+ require "rspec/expectations"
+ Rspec.configure {|c| c.color_enabled = true }
"""
And a file named "spec/example_spec.rb" with:
"""
@@ -38,6 +37,8 @@ Feature: spec/spec.opts
"""
And a file named "spec/example_spec.rb" with:
"""
+ require "rspec/expectations"
+
describe "color_enabled" do
context "when set with Rspec.configure" do
it "is true" do
@@ -49,20 +50,21 @@ Feature: spec/spec.opts
When I run "rspec spec/example_spec.rb"
Then the stdout should match "1 example, 0 failures"
+ @wip
Scenario: formatter set in both (spec.opts wins)
Given a file named "spec/spec.opts" with:
"""
--formatter documentation
"""
-
And a file named "spec/spec_helper.rb" with:
"""
- Rspec.configure do |c|
- c.formatter = 'pretty'
- end
+ require "rspec/expectations"
+ Rspec.configure {|c| c.formatter = 'progress'}
"""
And a file named "spec/example_spec.rb" with:
"""
+ require "spec_helper"
+
describe "formatter" do
context "when set with Rspec.configure and in spec.opts" do
it "takes the value set in spec.opts" do
View
4 features/example_groups/describe_aliases.feature
@@ -7,7 +7,9 @@ Feature: Nested example groups
Scenario: Using context
Given a file named "context_instead_of_describe_spec.rb" with:
"""
- context "Using context" do
+ require "rspec/expectations"
+
+ describe "Using context" do
context "with nested context" do
it "should do this" do
true.should be_true
View
2  features/expectations/customized_message.feature
@@ -7,6 +7,8 @@ Feature: customized message
Scenario: one additional method
Given a file named "node_spec.rb" with:
"""
+ require "rspec/expectations"
+
class Node
def initialize(state=:waiting)
@state = state
View
8 features/hooks/before_and_after_hooks.feature
@@ -31,6 +31,8 @@ Feature: before and after hooks
Scenario: define before(:each) block in example group
Given a file named "before_each_in_example_group_spec.rb" with:
"""
+ require "rspec/expectations"
+
class Thing
def widgets
@widgets ||= []
@@ -63,6 +65,8 @@ Feature: before and after hooks
Scenario: define before(:all) block in example group
Given a file named "before_all_in_example_group_spec.rb" with:
"""
+ require "rspec/expectations"
+
class Thing
def widgets
@widgets ||= []
@@ -96,6 +100,8 @@ Feature: before and after hooks
Scenario: define before and after blocks in configuration
Given a file named "befores_in_configuration_spec.rb" with:
"""
+ require "rspec/expectations"
+
Rspec.configure do |config|
config.before(:suite) do
$before_suite = "before suite"
@@ -133,6 +139,8 @@ Feature: before and after hooks
Scenario: before/after blocks are run in order
Given a file named "ensure_block_order_spec.rb" with:
"""
+ require "rspec/expectations"
+
Rspec.configure do |config|
config.before(:suite) do
puts "before suite"
View
6 features/matchers/define_matcher_outside_rspec.feature
@@ -7,8 +7,8 @@ Feature: define matcher outside rspec
Scenario: define a matcher with default messages
Given a file named "test_multiples.rb" with:
"""
- require 'test/unit'
- require 'rspec/expectations'
+ require "test/unit"
+ require "rspec/expectations"
Rspec::Matchers.define :be_a_multiple_of do |expected|
match do |actual|
@@ -35,4 +35,4 @@ Feature: define matcher outside rspec
When I run "ruby test_multiples.rb"
Then the exit code should be 256
And the stdout should match "expected 9 to be a multiple of 4"
- And the stdout should match "2 tests, 0 assertions, 0 failures, 1 errors"
+ And the stdout should match "2 tests, 0 assertions, 1 failures, 0 errors"
View
3  features/support/env.rb
@@ -62,9 +62,6 @@ def ruby(args)
$LOAD_PATH.unshift(File.expand_path('../../../lib', __FILE__))
$LOAD_PATH.unshift(File.expand_path('../../../../rspec-expectations/lib', __FILE__))
$LOAD_PATH.unshift(File.expand_path('../../../../rspec-mocks/lib', __FILE__))
-require 'rspec/core'
-require 'rspec/expectations'
-Rspec::Core::ExampleGroup.__send__(:include, Rspec::Matchers)
CONTENT
end
cmd = "-rrubygems -rload_paths.rb #{rspec_libs} #{args}"
Please sign in to comment.
Something went wrong with that request. Please try again.