diff --git a/Changelog.md b/Changelog.md index 5fe52a3469..255ae7e0a2 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,3 +1,10 @@ +### 2.99.2 development +[Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.1...master) + +Enhancements: + +* Tweak deprecation warning for `Symbol` descriptions. (Jon Rowe, #1667) + ### 2.99.1 / 2014-06-19 [Full Changelog](http://github.com/rspec/rspec-core/compare/v2.99.0...v2.99.1) diff --git a/lib/rspec/core/example_group.rb b/lib/rspec/core/example_group.rb index ae62deb16e..4d47faa73c 100644 --- a/lib/rspec/core/example_group.rb +++ b/lib/rspec/core/example_group.rb @@ -350,8 +350,9 @@ def warning <<-EOS.gsub(/^\s+\|/, '') |The semantics of `describe ` are changing in RSpec 3. In RSpec 2, |this would be treated as metadata, but as the first `describe` argument, - |this will be treated as the described object in RSpec 3. If you want this - |to be treated as metadata, pass a description as the first argument. + |this will be treated as the described object (affecting the value of + |`described_class`) in RSpec 3. If you want this to be treated as metadata, + |pass a description as the first argument. |(Example group defined at #{call_site}) EOS end diff --git a/spec/rspec/core/example_group_spec.rb b/spec/rspec/core/example_group_spec.rb index 05b0a3e998..8f911da255 100644 --- a/spec/rspec/core/example_group_spec.rb +++ b/spec/rspec/core/example_group_spec.rb @@ -344,7 +344,7 @@ def capture_deprecation_options warn_opts end - it "prints a deprecation warning since the semantics are changing in RSpec 3" do + it "prints a deprecation warning since the semantics of an inner described_class are changing in RSpec 3" do warn_opts = capture_deprecation_options do ExampleGroup.describe(String) do describe Array do @@ -357,6 +357,19 @@ def capture_deprecation_options expect(warn_opts[:message]).to include("described_class") end + it "prints a deprecation warning since the semantics of an inner described symbol are changing in RSpec 3" do + warn_opts = capture_deprecation_options do + ExampleGroup.describe(String) do + describe :method do + example { described_class } + end + end.run + end + + expect(warn_opts[:message]).to include("#{__FILE__}:#{__LINE__ - 6}") + expect(warn_opts[:message]).to include("described_class") + end + it "prints a deprecation even when `described_class` has already been referenced in the outer group" do warn_opts = capture_deprecation_options do outer_dc = inner_dc = nil