summaryrefslogtreecommitdiff
path: root/spec/unit/deprecation_spec.rb
diff options
context:
space:
mode:
authorsersut <serdar@opscode.com>2013-05-16 09:59:48 -0700
committersersut <serdar@opscode.com>2013-05-16 09:59:48 -0700
commit436d2eeb061153c32801b1c80074b9fc646d7a8e (patch)
treec3bfc92cccc2078880355731feae965572193166 /spec/unit/deprecation_spec.rb
parentad2a8d7ab69213d7f2a6b367be12fa506adcb9b3 (diff)
downloadchef-436d2eeb061153c32801b1c80074b9fc646d7a8e.tar.gz
Fixes for PR review comments from Dan.
Diffstat (limited to 'spec/unit/deprecation_spec.rb')
-rw-r--r--spec/unit/deprecation_spec.rb52
1 files changed, 26 insertions, 26 deletions
diff --git a/spec/unit/deprecation_spec.rb b/spec/unit/deprecation_spec.rb
index fcd47b8084..8d51fa9b0f 100644
--- a/spec/unit/deprecation_spec.rb
+++ b/spec/unit/deprecation_spec.rb
@@ -21,7 +21,31 @@ require 'chef/deprecation/warnings'
describe Chef::Deprecation do
- it "method snapshot before file-refactor should match current methods" do
+ # Support code for Chef::Deprecation
+
+ def class_from_string(str)
+ str.split('::').inject(Object) do |mod, class_name|
+ mod.const_get(class_name)
+ end
+ end
+
+ module DeprecatedMethods
+ def deprecated_method(value)
+ @value = value
+ end
+
+ def get_value
+ @value
+ end
+ end
+
+ class TestClass
+ extend Chef::Deprecation::Warnings
+ include DeprecatedMethods
+ add_deprecation_warnings_for(DeprecatedMethods.instance_methods)
+ end
+
+ it "defines all methods that were available in 11.0" do
method_snapshot_file = File.join(CHEF_SPEC_DATA, "file-providers-method-snapshot-chef-11-4.json")
method_snapshot = JSON.parse(File.open(method_snapshot_file).read())
@@ -30,9 +54,7 @@ describe Chef::Deprecation do
current_methods = class_object.public_instance_methods
old_methods.each do |old_method|
- if !current_methods.include?(old_method.to_sym)
- fail "Can not find method '#{old_method.to_sym}' for class '#{class_name}'"
- end
+ current_methods.should include(old_method.to_sym)
end
end
end
@@ -60,27 +82,5 @@ describe Chef::Deprecation do
test_instance.get_value.should == 10
end
- def class_from_string(str)
- str.split('::').inject(Object) do |mod, class_name|
- mod.const_get(class_name)
- end
- end
-
- module DeprecatedMethods
- def deprecated_method(value)
- @value = value
- end
-
- def get_value
- @value
- end
- end
-
- class TestClass
- extend Chef::Deprecation::Warnings
- include DeprecatedMethods
- add_deprecation_warnings_for(DeprecatedMethods.instance_methods)
- end
-
end