summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXabier de Zuazo <xabier@onddo.com>2014-12-03 06:39:34 +0100
committerLamont Granquist <lamont@scriptkiddie.org>2015-01-27 12:04:44 -0800
commitdbb472b31267bba8b8df888cb5901fa193792a10 (patch)
tree696802e1b4824a070046484638384a14708266d7
parente07b1d2a1c7e75ad0a395e2380bf6618f2aa559f (diff)
downloadchef-dbb472b31267bba8b8df888cb5901fa193792a10.tar.gz
Util::Diff: remove Object::Encoding existence check (ruby 1.8 specific, issue #2497)
-rw-r--r--lib/chef/util/diff.rb5
-rw-r--r--spec/unit/util/diff_spec.rb12
2 files changed, 7 insertions, 10 deletions
diff --git a/lib/chef/util/diff.rb b/lib/chef/util/diff.rb
index 3117484a71..c2dc6e045c 100644
--- a/lib/chef/util/diff.rb
+++ b/lib/chef/util/diff.rb
@@ -176,10 +176,7 @@ class Chef
end
def encode_diff_for_json(diff_str)
- if Object.const_defined? :Encoding
- diff_str.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')
- end
- return diff_str
+ diff_str.encode!('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?')
end
end
diff --git a/spec/unit/util/diff_spec.rb b/spec/unit/util/diff_spec.rb
index ea226f1c04..b0a57a32c0 100644
--- a/spec/unit/util/diff_spec.rb
+++ b/spec/unit/util/diff_spec.rb
@@ -105,7 +105,7 @@ shared_examples_for "a diff util" do
end
end
- describe "when the default external encoding is UTF-8", :ruby_gte_19_only do
+ describe "when the default external encoding is UTF-8" do
before do
@saved_default_external = Encoding.default_external
@@ -170,7 +170,7 @@ shared_examples_for "a diff util" do
end
- describe "when the default external encoding is Latin-1", :ruby_gte_19_only do
+ describe "when the default external encoding is Latin-1" do
before do
@saved_default_external = Encoding.default_external
@@ -234,7 +234,7 @@ shared_examples_for "a diff util" do
end
end
- describe "when the default external encoding is Shift_JIS", :ruby_gte_19_only do
+ describe "when the default external encoding is Shift_JIS" do
before do
@saved_default_external = Encoding.default_external
@@ -411,7 +411,7 @@ shared_examples_for "a diff util" do
end
end
- describe "when the default external encoding is UTF-8", :ruby_gte_19_only do
+ describe "when the default external encoding is UTF-8" do
before do
@saved_default_external = Encoding.default_external
@@ -456,7 +456,7 @@ shared_examples_for "a diff util" do
end
- describe "when the default external encoding is Latin-1", :ruby_gte_19_only do
+ describe "when the default external encoding is Latin-1" do
before do
@saved_default_external = Encoding.default_external
@@ -500,7 +500,7 @@ shared_examples_for "a diff util" do
end
end
- describe "when the default external encoding is Shift-JIS", :ruby_gte_19_only do
+ describe "when the default external encoding is Shift-JIS" do
before do
@saved_default_external = Encoding.default_external