summaryrefslogtreecommitdiff
path: root/spec/hunk_spec.rb
diff options
context:
space:
mode:
authorAustin Ziegler <austin@zieglers.ca>2019-01-27 00:15:29 -0500
committerAustin Ziegler <austin@zieglers.ca>2019-01-27 23:26:05 -0500
commit45ea1b30c7de0ad840f72afb82fd41eb2b9590db (patch)
tree22f879cbd21a183bac5c17f754c0aa598531d968 /spec/hunk_spec.rb
parent07ed577eba341f0ff0d7eebf4c1c2cc23083cba7 (diff)
downloaddiff-lcs-45ea1b30c7de0ad840f72afb82fd41eb2b9590db.tar.gz
Applied Rubocop rules that I like
- Other linting configuration also applied. - Soft-deprecating versions older than 2.3.
Diffstat (limited to 'spec/hunk_spec.rb')
-rw-r--r--spec/hunk_spec.rb26
1 files changed, 13 insertions, 13 deletions
diff --git a/spec/hunk_spec.rb b/spec/hunk_spec.rb
index 0711e0d..5a45072 100644
--- a/spec/hunk_spec.rb
+++ b/spec/hunk_spec.rb
@@ -1,4 +1,4 @@
-# -*- ruby encoding: utf-8 -*-
+# frozen_string_literal: true
require 'spec_helper'
@@ -6,52 +6,52 @@ if String.method_defined?(:encoding)
require 'diff/lcs/hunk'
describe Diff::LCS::Hunk do
- let(:old_data) { ["Tu avec carté {count} itém has".encode('UTF-16LE')] }
- let(:new_data) { ["Tu avec carte {count} item has".encode('UTF-16LE')] }
+ let(:old_data) { ['Tu avec carté {count} itém has'.encode('UTF-16LE')] }
+ let(:new_data) { ['Tu avec carte {count} item has'.encode('UTF-16LE')] }
let(:pieces) { Diff::LCS.diff old_data, new_data }
let(:hunk) { Diff::LCS::Hunk.new(old_data, new_data, pieces[0], 3, 0) }
it 'produces a unified diff from the two pieces' do
- expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
+ expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
@@ -1,2 +1,2 @@
-Tu avec carté {count} itém has
+Tu avec carte {count} item has
- EOD
+ EXPECTED
expect(hunk.diff(:unified)).to eq(expected)
end
it 'produces a context diff from the two pieces' do
- expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
+ expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
***************
*** 1,2 ****
!Tu avec carté {count} itém has
--- 1,2 ----
!Tu avec carte {count} item has
- EOD
+ EXPECTED
expect(hunk.diff(:context)).to eq(expected)
end
it 'produces an old diff from the two pieces' do
- expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp)
+ expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp
1,2c1,2
< Tu avec carté {count} itém has
---
> Tu avec carte {count} item has
- EOD
+ EXPECTED
expect(hunk.diff(:old)).to eq(expected)
end
it 'produces a reverse ed diff from the two pieces' do
- expected = (<<-EOD.gsub(/^ +/,'').encode('UTF-16LE').chomp)
+ expected = <<-EXPECTED.gsub(/^ +/, '').encode('UTF-16LE').chomp
c1,2
Tu avec carte {count} item has
.
- EOD
+ EXPECTED
expect(hunk.diff(:reverse_ed)).to eq(expected)
end
@@ -60,10 +60,10 @@ if String.method_defined?(:encoding)
let(:old_data) { [] }
it 'produces a unified diff' do
- expected = (<<-EOD.gsub(/^\s+/,'').encode('UTF-16LE').chomp)
+ expected = <<-EXPECTED.gsub(/^\s+/, '').encode('UTF-16LE').chomp
@@ -1 +1,2 @@
+Tu avec carte {count} item has
- EOD
+ EXPECTED
expect(hunk.diff(:unified)).to eq(expected)
end