Skip to content

Commit

Permalink
change top-level module from Rspec to RSpec
Browse files Browse the repository at this point in the history
- capture const_missing on Rspec and return RSpec
  • Loading branch information
dchelimsky committed May 30, 2010
1 parent 67584c9 commit bcb1dfa
Show file tree
Hide file tree
Showing 69 changed files with 244 additions and 242 deletions.
8 changes: 4 additions & 4 deletions README.markdown
@@ -1,9 +1,9 @@
# Rspec Core
# RSpec Core

Rspec is an automated testing framework for Ruby, designed for use in Behaviour
RSpec is an automated testing framework for Ruby, designed for use in Behaviour
Driven Development and Test Driven Development.

rspec-core includes the Rspec runner, output formatters, and the `rspec`
rspec-core includes the RSpec runner, output formatters, and the `rspec`
command.

## Upgrading from rspec-1.x
Expand Down Expand Up @@ -46,7 +46,7 @@ Implement the simplest solution:
Be sure to require the implementation file in the spec:

# in spec/calculator_spec.rb
# - Rspec adds ./lib to the $LOAD_PATH, so you can
# - RSpec adds ./lib to the $LOAD_PATH, so you can
# just require "calculator" directly
require "calculator"

Expand Down
18 changes: 9 additions & 9 deletions Rakefile
Expand Up @@ -13,15 +13,15 @@ begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "rspec-core"
gem.version = Rspec::Core::Version::STRING
gem.summary = "rspec-core-#{Rspec::Core::Version::STRING}"
gem.description = 'Rspec runner and example group classes'
gem.version = RSpec::Core::Version::STRING
gem.summary = "rspec-core-#{RSpec::Core::Version::STRING}"
gem.description = 'RSpec runner and example group classes'
gem.email = "dchelimsky@gmail.com;chad.humphries@gmail.com"
gem.homepage = "http://github.com/rspec/core"
gem.authors = ["Chad Humphries", "David Chelimsky"]
gem.rubyforge_project = "rspec"
gem.add_development_dependency "rspec-expectations", ">= #{Rspec::Core::Version::STRING}"
gem.add_development_dependency "rspec-mocks", ">= #{Rspec::Core::Version::STRING}"
gem.add_development_dependency "rspec-expectations", ">= #{RSpec::Core::Version::STRING}"
gem.add_development_dependency "rspec-mocks", ">= #{RSpec::Core::Version::STRING}"
gem.add_development_dependency('cucumber', '>= 0.5.3')
gem.add_development_dependency('autotest', '>= 4.2.9')
gem.post_install_message = <<-EOM
Expand All @@ -43,14 +43,14 @@ end
namespace :gem do
desc "push to gemcutter"
task :push => :build do
system "gem push pkg/rspec-core-#{Rspec::Core::Version::STRING}.gem"
system "gem push pkg/rspec-core-#{RSpec::Core::Version::STRING}.gem"
end
end

Rspec::Core::RakeTask.new(:spec)
RSpec::Core::RakeTask.new(:spec)

desc "Run all examples using rcov"
Rspec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
RSpec::Core::RakeTask.new :rcov => :cleanup_rcov_files do |t|
t.rcov = true
t.rcov_opts = %[-Ilib -Ispec --exclude "mocks,expectations,gems/*,spec/resources,spec/lib,spec/spec_helper.rb,db/*,/Library/Ruby/*,config/*"]
t.rcov_opts << %[--no-html --aggregate coverage.data]
Expand Down Expand Up @@ -85,7 +85,7 @@ end

Rake::RDocTask.new do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = "rspec-core #{Rspec::Core::Version::STRING}"
rdoc.title = "rspec-core #{RSpec::Core::Version::STRING}"
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Expand Down
12 changes: 6 additions & 6 deletions Upgrade.markdown
Expand Up @@ -2,16 +2,16 @@

## What's changed

### Rspec namespace
### RSpec namespace

The root namespace is now `Rspec` instead of `Spec`, and the root directory
The root namespace is now `RSpec` instead of `Spec`, and the root directory
under `lib` is `rspec` instead of `spec`.

### Configuration

Typically in `spec/spec_helper.rb`, configuration is now done like this:

Rspec.configure do |c|
RSpec.configure do |c|
# ....
end

Expand All @@ -38,7 +38,7 @@ each example in a variety of ways.
The most obvious use is for filtering the run. For example:

# in spec/spec_helper.rb
Rspec.configure do |c|
RSpec.configure do |c|
c.filter_run :focus => true
end

Expand All @@ -54,7 +54,7 @@ When you run the `rspec` command, rspec will run only the examples that have

You can also add `run_all_when_everything_filtered` to the config:

Rspec.configure do |c|
RSpec.configure do |c|
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
end
Expand All @@ -72,7 +72,7 @@ rspec-core, and here's how we're getting the right stuff to run under the
right version:

# in spec/spec_helper.rb
Rspec.configure do |c|
RSpec.configure do |c|
c.exclusion_filter = { :ruby => lambda {|version|
!(RUBY_VERSION.to_s =~ /^#{version.to_s}/)
}}
Expand Down
2 changes: 1 addition & 1 deletion example_specs/spec_helper.rb
Expand Up @@ -4,7 +4,7 @@
require 'rspec/expectations'
require 'rspec/core'

Rspec.configure do |c|
RSpec.configure do |c|
c.mock_with :rspec
end

2 changes: 1 addition & 1 deletion features/command_line/line_number_option.feature
@@ -1,6 +1,6 @@
Feature: line number option

As an Rspec user
As an RSpec user
I want to run one example identified by the line number

Scenario: standard examples
Expand Down
24 changes: 12 additions & 12 deletions features/configuration/custom_options.feature
@@ -1,23 +1,23 @@
Feature: custom options

In order to seamlessly provide my users more options
As an Rspec extenstion-library author
I want to define new options on the Rspec.configuration
As an RSpec extenstion-library author
I want to define new options on the RSpec.configuration

Scenario: boolean option with default settings
Given a file named "boolean_option_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.add_option :custom_option, :type => :boolean
end
describe "custom option" do
it "is false by default" do
Rspec.configuration.custom_option.should be_false
RSpec.configuration.custom_option.should be_false
end
it "is exposed as a predicate" do
Rspec.configuration.custom_option?.should be_false
RSpec.configuration.custom_option?.should be_false
end
end
"""
Expand All @@ -27,17 +27,17 @@ Feature: custom options
Scenario: boolean option set to default to true
Given a file named "boolean_option_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.add_option :custom_option, :type => :boolean, :default => true
end
describe "custom option" do
it "is true by default" do
Rspec.configuration.custom_option.should be_true
RSpec.configuration.custom_option.should be_true
end
it "is exposed as a predicate" do
Rspec.configuration.custom_option?.should be_true
RSpec.configuration.custom_option?.should be_true
end
end
"""
Expand All @@ -48,21 +48,21 @@ Feature: custom options
Scenario: boolean option overridden in client app
Given a file named "boolean_option_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.add_option :custom_option, :type => :boolean
end
Rspec.configure do |c|
RSpec.configure do |c|
c.custom_option = true
end
describe "custom option" do
it "returns the value set in the client app" do
Rspec.configuration.custom_option.should be_true
RSpec.configuration.custom_option.should be_true
end
it "is exposed as a predicate" do
Rspec.configuration.custom_option?.should be_true
RSpec.configuration.custom_option?.should be_true
end
end
"""
Expand Down
20 changes: 10 additions & 10 deletions features/configuration/options_file.feature
Expand Up @@ -5,17 +5,17 @@ Feature: spec/spec.opts
automatically.

Options declared in spec/spec.opts will override configuration
set up in Rspec.configure blocks.
set up in RSpec.configure blocks.

Scenario: color set in Rspec.configure
Scenario: color set in RSpec.configure
Given a file named "spec/example_spec.rb" with:
"""
Rspec.configure {|c| c.color_enabled = true }
RSpec.configure {|c| c.color_enabled = true }
describe "color_enabled" do
context "when set with Rspec.configure" do
context "when set with RSpec.configure" do
it "is true" do
Rspec.configuration.color_enabled?.should be_true
RSpec.configuration.color_enabled?.should be_true
end
end
end
Expand All @@ -31,9 +31,9 @@ Feature: spec/spec.opts
And a file named "spec/example_spec.rb" with:
"""
describe "color_enabled" do
context "when set with Rspec.configure" do
context "when set with RSpec.configure" do
it "is true" do
Rspec.configuration.color_enabled?.should be_true
RSpec.configuration.color_enabled?.should be_true
end
end
end
Expand All @@ -49,16 +49,16 @@ Feature: spec/spec.opts
"""
And a file named "spec/spec_helper.rb" with:
"""
Rspec.configure {|c| c.formatter = 'progress'}
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
context "when set with RSpec.configure and in spec.opts" do
it "takes the value set in spec.opts" do
Rspec.configuration.formatter.should be_an(Rspec::Core::Formatters::DocumentationFormatter)
RSpec.configuration.formatter.should be_an(RSpec::Core::Formatters::DocumentationFormatter)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions features/filtering/inclusion_filters.feature
Expand Up @@ -3,7 +3,7 @@ Feature: inclusion feature
Scenario: focus on one example
Given a file named "spec/sample_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.filter_run :focus => true
end
Expand All @@ -22,7 +22,7 @@ Feature: inclusion feature
Scenario: focus on one group
Given a file named "spec/sample_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.filter_run :focus => true
end
Expand All @@ -47,7 +47,7 @@ Feature: inclusion feature
Scenario: no examples match filter
Given a file named "spec/sample_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.filter_run :focus => true
c.run_all_when_everything_filtered = true
end
Expand Down
2 changes: 1 addition & 1 deletion features/hooks/before_and_after_hooks.feature
Expand Up @@ -100,7 +100,7 @@ Feature: before and after hooks
"""
require "rspec/expectations"
Rspec.configure do |config|
RSpec.configure do |config|
config.before(:each) do
@before_each = "before each"
end
Expand Down
2 changes: 1 addition & 1 deletion features/hooks/halt.feature
Expand Up @@ -9,7 +9,7 @@ Feature: halt
Given a directory named "spec"
And a file named "spec/example_spec.rb" with:
"""
Rspec.configure do |c|
RSpec.configure do |c|
c.after(:each) do
running_example.halt(:group, :status => 'failed')
end
Expand Down
2 changes: 1 addition & 1 deletion features/mock_framework_integration/use_flexmock.feature
Expand Up @@ -6,7 +6,7 @@ Feature: mock with flexmock
Scenario: Mock with flexmock
Given a file named "flexmock_example_spec.rb" with:
"""
Rspec.configure do |config|
RSpec.configure do |config|
config.mock_framework = :flexmock
end
Expand Down
2 changes: 1 addition & 1 deletion features/mock_framework_integration/use_mocha.feature
Expand Up @@ -6,7 +6,7 @@ Feature: mock with mocha
Scenario: Mock with mocha
Given a file named "mocha_example_spec.rb" with:
"""
Rspec.configure do |config|
RSpec.configure do |config|
config.mock_framework = :mocha
end
Expand Down
2 changes: 1 addition & 1 deletion features/mock_framework_integration/use_rr.feature
Expand Up @@ -6,7 +6,7 @@ Feature: mock with rr
Scenario: Mock with rr
Given a file named "rr_example_spec.rb" with:
"""
Rspec.configure do |config|
RSpec.configure do |config|
config.mock_framework = :rr
end
Expand Down
2 changes: 1 addition & 1 deletion features/mock_framework_integration/use_rspec.feature
Expand Up @@ -6,7 +6,7 @@ Feature: mock with rspec
Scenario: Mock with rspec
Given a file named "rspec_example_spec.rb" with:
"""
Rspec.configure do |config|
RSpec.configure do |config|
config.mock_framework = :rspec
end
Expand Down
2 changes: 1 addition & 1 deletion features/pending/pending_examples.feature
@@ -1,6 +1,6 @@
Feature: pending examples

Rspec offers three ways to indicate that an example is disabled pending
RSpec offers three ways to indicate that an example is disabled pending
some action.

Scenario: pending implementation
Expand Down
2 changes: 1 addition & 1 deletion lib/autotest/rspec2.rb
Expand Up @@ -14,7 +14,7 @@
}
end

class RspecCommandError < StandardError; end
class RSpecCommandError < StandardError; end

class Autotest::Rspec2 < Autotest

Expand Down
2 changes: 1 addition & 1 deletion lib/rspec/autorun.rb
@@ -1,2 +1,2 @@
require 'rspec/core'
Rspec::Core::Runner.autorun
RSpec::Core::Runner.autorun

0 comments on commit bcb1dfa

Please sign in to comment.