Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

deprecate Rspec::Core.configure

  • Loading branch information...
commit b8ddd846bc52d68929ff8171fa16aac8ec07fc8d 1 parent 46deacf
@dchelimsky dchelimsky authored
Showing with 26 additions and 26 deletions.
  1. +1 −0  lib/rspec/core.rb
  2. +25 −26 lib/rspec/core/deprecation.rb
View
1  lib/rspec/core.rb
@@ -28,6 +28,7 @@ def self.configuration
end
def self.configure
+ Rspec.deprecate('Rspec::Core.configure', 'Rspec.configure', '2.0.0')
yield configuration if block_given?
end
View
51 lib/rspec/core/deprecation.rb
@@ -1,47 +1,46 @@
module Rspec
- module Core
- class << self
- def deprecate(method, alternate_method=nil)
- message = <<-NOTICE
+ class << self
+ def deprecate(method, alternate_method=nil, version=nil)
+ version_string = version ? "rspec-#{version}" : "a future version of Rspec"
+
+ message = <<-NOTICE
*****************************************************************
DEPRECATION WARNING: you are using deprecated behaviour that will
-be removed from a future version of RSpec.
+be removed from #{version_string}.
#{caller(0)[2]}
* #{method} is deprecated.
NOTICE
- if alternate_method
- message << <<-ADDITIONAL
+ if alternate_method
+ message << <<-ADDITIONAL
* please use #{alternate_method} instead.
ADDITIONAL
- end
-
- message << "*****************************************************************"
- warn(message)
end
- def warn(message)
- Kernel.warn(message)
- end
+ message << "*****************************************************************"
+ warn(message)
+ end
+ def warn(message)
+ Kernel.warn(message)
end
- class HashWithDeprecationNotice < Hash
-
- def initialize(method, alternate_method=nil, &block)
- @method, @alternate_method = method, alternate_method
- end
-
- def []=(k,v)
- Rspec.deprecate(@method, @alternate_method)
- super
- end
-
+ end
+
+ class HashWithDeprecationNotice < Hash
+
+ def initialize(method, alternate_method=nil, &block)
+ @method, @alternate_method = method, alternate_method
+ end
+
+ def []=(k,v)
+ Rspec.deprecate(@method, @alternate_method)
+ super
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.