summaryrefslogtreecommitdiff
path: root/spec/unit/util/diff_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/unit/util/diff_spec.rb')
-rw-r--r--spec/unit/util/diff_spec.rb21
1 files changed, 2 insertions, 19 deletions
diff --git a/spec/unit/util/diff_spec.rb b/spec/unit/util/diff_spec.rb
index 8a2bef2858..4b5ac9c8b8 100644
--- a/spec/unit/util/diff_spec.rb
+++ b/spec/unit/util/diff_spec.rb
@@ -16,7 +16,6 @@
# limitations under the License.
#
-
require "spec_helper"
require "tmpdir"
@@ -106,7 +105,6 @@ shared_examples_for "a diff util" do
end
describe "when the default external encoding is UTF-8" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::UTF_8
@@ -167,11 +165,9 @@ shared_examples_for "a diff util" do
expect(differ.for_reporting).to be_nil
end
end
-
end
describe "when the default external encoding is Latin-1" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::ISO_8859_1
@@ -232,10 +228,8 @@ shared_examples_for "a diff util" do
expect(differ.for_reporting).to be_nil
end
end
-
end
describe "when the default external encoding is Shift_JIS" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::Shift_JIS
@@ -296,7 +290,6 @@ shared_examples_for "a diff util" do
expect(differ.for_reporting.encoding).to equal(Encoding::UTF_8)
end
end
-
end
describe "when testing the diff_filesize_threshold" do
@@ -358,7 +351,6 @@ shared_examples_for "a diff util" do
end
describe "when the diff output is too long" do
-
before do
@diff_output_threshold_saved = Chef::Config[:diff_output_threshold]
Chef::Config[:diff_output_threshold] = 10
@@ -379,7 +371,6 @@ shared_examples_for "a diff util" do
end
describe "when checking if files are binary or text" do
-
it "should identify zero-length files as text" do
Tempfile.open("chef-util-diff-spec") do |file|
file.close
@@ -412,7 +403,6 @@ shared_examples_for "a diff util" do
end
describe "when the default external encoding is UTF-8" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::UTF_8
@@ -453,11 +443,9 @@ shared_examples_for "a diff util" do
expect(differ.send(:is_binary?, file.path)).to be_truthy
end
end
-
end
describe "when the default external encoding is Latin-1" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::ISO_8859_1
@@ -501,7 +489,6 @@ shared_examples_for "a diff util" do
end
describe "when the default external encoding is Shift-JIS" do
-
before do
@saved_default_external = Encoding.default_external
Encoding.default_external = Encoding::Shift_JIS
@@ -541,10 +528,8 @@ shared_examples_for "a diff util" do
expect(differ.send(:is_binary?, file.path)).to be_falsey
end
end
-
end
end
-
end
describe Chef::Util::Diff, :uses_diff => true do
@@ -553,11 +538,11 @@ describe Chef::Util::Diff, :uses_diff => true do
let(:plain_ascii) { "This is a text file.\nWith more than one line.\nAnd a \tTab.\nAnd lets make sure that other printable chars work too: ~!@\#$%^&*()`:\"<>?{}|_+,./;'[]\\-=\n" }
# these are all byte sequences that are illegal in the other encodings... (but they may legally transcode)
- let(:utf_8) { "testing utf-8 unicode...\n\n\non a new line: \xE2\x80\x93\n" } # unicode em-dash
+ let(:utf_8) { "testing utf-8 unicode...\n\n\non a new line: \xE2\x80\x93\n" } # unicode em-dash
let(:latin_1) { "It is more metal.\nif you have an \xFDmlaut.\n" } # NB: changed to y-with-diaresis, but i'm American so I don't know the difference
let(:shift_jis) { "I have no idea what this character is:\n \x83\x80.\n" } # seriously, no clue, but \x80 is nice and illegal in other encodings
- let(:differ) do # subject
+ let(:differ) do # subject
differ = Chef::Util::Diff.new
differ.diff(old_file, new_file)
differ
@@ -569,11 +554,9 @@ describe Chef::Util::Diff, :uses_diff => true do
it_behaves_like "a diff util"
end
-
describe "when file path doesn't have spaces" do
include_context "using file paths without spaces"
it_behaves_like "a diff util"
end
end
-