Skip to content
Browse files

Rspec.configure (instead of Rspec::Core.configure)

  • Loading branch information...
1 parent e18e769 commit 46deacfbc3d27a3fac8e9a1257d96f4a8603a96d @dchelimsky dchelimsky committed Feb 12, 2010
View
2 example_specs/spec_helper.rb
@@ -4,7 +4,7 @@
require 'rspec/expectations'
require 'rspec/autorun'
-Rspec::Core.configure do |c|
+Rspec.configure do |c|
c.mock_with :rspec
c.include Rspec::Matchers
end
View
14 features/configuration/spec_opts.feature
@@ -5,23 +5,23 @@ Feature: spec/spec.opts
automatically.
Options declared in spec/spec.opts will override configuration
- set up in Rspec::Core.configure blocks.
+ set up in Rspec.configure blocks.
Background:
Given a directory named "spec"
- Scenario: color set in Rspec::Core.configure
+ Scenario: color set in Rspec.configure
Given a file named "spec/spec_helper.rb" with:
"""
- Rspec::Core.configure do |c|
+ Rspec.configure do |c|
c.color_enabled = true
end
"""
And a file named "spec/example_spec.rb" with:
"""
require "spec_helper"
describe "color_enabled" do
- context "when set with Rspec::Core.configure" do
+ context "when set with Rspec.configure" do
it "is true" do
Rspec::Core.configuration.color_enabled?.should be_true
end
@@ -39,7 +39,7 @@ Feature: spec/spec.opts
And a file named "spec/example_spec.rb" with:
"""
describe "color_enabled" do
- context "when set with Rspec::Core.configure" do
+ context "when set with Rspec.configure" do
it "is true" do
Rspec::Core.configuration.color_enabled?.should be_true
end
@@ -57,14 +57,14 @@ Feature: spec/spec.opts
And a file named "spec/spec_helper.rb" with:
"""
- Rspec::Core.configure do |c|
+ Rspec.configure do |c|
c.formatter = 'pretty'
end
"""
And a file named "spec/example_spec.rb" with:
"""
describe "formatter" do
- context "when set with Rspec::Core.configure and in spec.opts" do
+ context "when set with Rspec.configure and in spec.opts" do
it "takes the value set in spec.opts" do
Rspec::Core.configuration.formatter.should be_an(Rspec::Core::Formatters::DocumentationFormatter)
end
View
2 features/hooks/around_hook.feature
@@ -1,4 +1,4 @@
-Feature: before and after blocks
+Feature: around hook
Scenario: define around(:each) block in example group
Given a file named "around_each_in_example_group_spec.rb" with:
View
6 features/hooks/before_and_after_hooks.feature
@@ -1,4 +1,4 @@
-Feature: before and after blocks
+Feature: before and after hooks
As a developer using RSpec
I want to execute arbitrary code before and after each example
@@ -96,7 +96,7 @@ Feature: before and after blocks
Scenario: define before and after blocks in configuration
Given a file named "befores_in_configuration_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.before(:suite) do
$before_suite = "before suite"
end
@@ -133,7 +133,7 @@ Feature: before and after blocks
Scenario: before/after blocks are run in order
Given a file named "ensure_block_order_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.before(:suite) do
puts "before suite"
end
View
2 features/mock_framework_integration/use_flexmock.feature
@@ -6,7 +6,7 @@ Feature: mock with flexmock
Scenario: Mock with flexmock
Given a file named "flexmock_example_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :flexmock
end
View
2 features/mock_framework_integration/use_mocha.feature
@@ -6,7 +6,7 @@ Feature: mock with mocha
Scenario: Mock with mocha
Given a file named "mocha_example_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :mocha
end
View
2 features/mock_framework_integration/use_rr.feature
@@ -6,7 +6,7 @@ Feature: mock with rr
Scenario: Mock with rr
Given a file named "rr_example_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :rr
end
View
2 features/mock_framework_integration/use_rspec.feature
@@ -6,7 +6,7 @@ Feature: mock with rspec
Scenario: Mock with rspec
Given a file named "rspec_example_spec.rb" with:
"""
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :rspec
end
View
4 features/mocks/block_local_expectations.feature
@@ -22,7 +22,7 @@ Feature: block local expectations
"""
require 'account'
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :rspec
end
@@ -47,7 +47,7 @@ Feature: block local expectations
"""
require 'account'
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :rspec
end
View
2 features/mocks/mix_stubs_and_mocks.feature
@@ -8,7 +8,7 @@ Feature: Spec and test together
"""
require 'rspec/expectations'
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.mock_framework = :rspec
end
View
4 lib/rspec/core.rb
@@ -36,4 +36,8 @@ def self.world
end
end
+
+ def self.configure
+ yield Core.configuration if block_given?
+ end
end
View
4 spec/rspec/core_spec.rb
@@ -13,13 +13,13 @@
describe "#configure" do
it "should yield the current configuration" do
- Rspec::Core.configure do |config|
+ Rspec.configure do |config|
config.should == Rspec::Core.configuration
end
end
it "should be callable without a block" do
- lambda { Rspec::Core.configure }.should_not raise_error
+ lambda { Rspec.configure }.should_not raise_error
end
end
View
2 spec/spec_helper.rb
@@ -39,7 +39,7 @@ def in_editor?
ENV.has_key?('TM_MODE') || ENV.has_key?('EMACS') || ENV.has_key?('VIM')
end
-Rspec::Core.configure do |c|
+Rspec.configure do |c|
c.mock_framework = :rspec
c.filter_run :focused => true
c.run_all_when_everything_filtered = true

0 comments on commit 46deacf

Please sign in to comment.
Something went wrong with that request. Please try again.