Permalink
Browse files

change top-level module from Rspec to RSpec

- capture const_missing on Rspec and return RSpec
  • Loading branch information...
1 parent 25e1496 commit 201905312a70ef5fe4006b92a9d363e4b3bfb4cf @dchelimsky dchelimsky committed May 17, 2010
Showing with 244 additions and 242 deletions.
  1. +4 −4 README.markdown
  2. +9 −9 Rakefile
  3. +6 −6 Upgrade.markdown
  4. +1 −1 example_specs/spec_helper.rb
  5. +1 −1 features/command_line/line_number_option.feature
  6. +12 −12 features/configuration/custom_options.feature
  7. +10 −10 features/configuration/options_file.feature
  8. +3 −3 features/filtering/inclusion_filters.feature
  9. +1 −1 features/hooks/before_and_after_hooks.feature
  10. +1 −1 features/hooks/halt.feature
  11. +1 −1 features/mock_framework_integration/use_flexmock.feature
  12. +1 −1 features/mock_framework_integration/use_mocha.feature
  13. +1 −1 features/mock_framework_integration/use_rr.feature
  14. +1 −1 features/mock_framework_integration/use_rspec.feature
  15. +1 −1 features/pending/pending_examples.feature
  16. +1 −1 lib/autotest/rspec2.rb
  17. +1 −1 lib/rspec/autorun.rb
  18. +9 −9 lib/rspec/core.rb
  19. +1 −1 lib/rspec/core/around_proxy.rb
  20. +15 −13 lib/rspec/core/backward_compatibility.rb
  21. +6 −6 lib/rspec/core/configuration.rb
  22. +2 −2 lib/rspec/core/configuration_options.rb
  23. +3 −3 lib/rspec/core/deprecation.rb
  24. +1 −1 lib/rspec/core/errors.rb
  25. +3 −3 lib/rspec/core/example.rb
  26. +8 −8 lib/rspec/core/example_group.rb
  27. +1 −1 lib/rspec/core/formatters.rb
  28. +4 −4 lib/rspec/core/formatters/base_formatter.rb
  29. +2 −2 lib/rspec/core/formatters/base_text_formatter.rb
  30. +2 −2 lib/rspec/core/formatters/documentation_formatter.rb
  31. +1 −1 lib/rspec/core/formatters/helpers.rb
  32. +1 −1 lib/rspec/core/formatters/progress_formatter.rb
  33. +1 −1 lib/rspec/core/hooks.rb
  34. +1 −1 lib/rspec/core/let.rb
  35. +1 −1 lib/rspec/core/load_path.rb
  36. +4 −4 lib/rspec/core/metadata.rb
  37. +1 −1 lib/rspec/core/mocking/with_absolutely_nothing.rb
  38. +1 −1 lib/rspec/core/mocking/with_flexmock.rb
  39. +1 −1 lib/rspec/core/mocking/with_mocha.rb
  40. +2 −2 lib/rspec/core/mocking/with_rr.rb
  41. +3 −3 lib/rspec/core/mocking/with_rspec.rb
  42. +3 −3 lib/rspec/core/object_extensions.rb
  43. +2 −2 lib/rspec/core/pending.rb
  44. +2 −2 lib/rspec/core/rake_task.rb
  45. +1 −1 lib/rspec/core/ruby_project.rb
  46. +7 −7 lib/rspec/core/runner.rb
  47. +5 −5 lib/rspec/core/shared_example_group.rb
  48. +1 −1 lib/rspec/core/subject.rb
  49. +1 −1 lib/rspec/core/version.rb
  50. +7 −7 lib/rspec/core/world.rb
  51. +2 −2 rspec-core.gemspec
  52. +7 −7 spec/rspec/core/configuration_options_spec.rb
  53. +2 −2 spec/rspec/core/configuration_spec.rb
  54. +1 −1 spec/rspec/core/deprecations_spec.rb
  55. +10 −10 spec/rspec/core/example_group_spec.rb
  56. +6 −6 spec/rspec/core/example_spec.rb
  57. +2 −2 spec/rspec/core/formatters/base_formatter_spec.rb
  58. +2 −2 spec/rspec/core/formatters/helpers_spec.rb
  59. +2 −2 spec/rspec/core/formatters/progress_formatter_spec.rb
  60. +2 −2 spec/rspec/core/metadata_spec.rb
  61. +7 −7 spec/rspec/core/pending_example_spec.rb
  62. +1 −1 spec/rspec/core/ruby_project_spec.rb
  63. +9 −9 spec/rspec/core/runner_spec.rb
  64. +3 −3 spec/rspec/core/shared_example_group_spec.rb
  65. +1 −1 spec/rspec/core/subject_spec.rb
  66. +9 −9 spec/rspec/core/world_spec.rb
  67. +9 −9 spec/rspec/core_spec.rb
  68. +9 −9 spec/spec_helper.rb
  69. +2 −2 spec/support/matchers.rb
View
@@ -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
@@ -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"
View
@@ -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
@@ -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]
@@ -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
View
@@ -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
@@ -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
@@ -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
@@ -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}/)
}}
@@ -4,7 +4,7 @@
require 'rspec/expectations'
require 'rspec/core'
-Rspec.configure do |c|
+RSpec.configure do |c|
c.mock_with :rspec
end
@@ -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
@@ -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
"""
@@ -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
"""
@@ -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
"""
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
View
@@ -14,7 +14,7 @@
}
end
-class RspecCommandError < StandardError; end
+class RSpecCommandError < StandardError; end
class Autotest::Rspec2 < Autotest
View
@@ -1,2 +1,2 @@
require 'rspec/core'
-Rspec::Core::Runner.autorun
+RSpec::Core::Runner.autorun
Oops, something went wrong.

4 comments on commit 2019053

Contributor

rsanheim replied May 17, 2010

This definitely looks nicer, but is it worth the additional magic needed to capture Rspec and return RSpec?

Owner

dchelimsky replied May 17, 2010

For me it is, for a variety of reasons, not the least of which is The RSpec Book (not The Rspec Book).

The reason for capturing Rspec is because there are libs (Cucumber) out there depending on that name already. Also, some other players in the eco-system (rails generators, autotest) need the name to be Rspec and not RSpec, so I think it's best to support both so as not to confuse users who may see the Rspec name in those files.

That all make sense?

Contributor

jacquescrocker replied May 17, 2010

Ah, great change. Thanks!

Contributor

rsanheim replied May 21, 2010

I definitely understand the motivation =). I just get worried about adding complexity, no matter how slight, for something that is mostly cosmetic.

Please sign in to comment.