summaryrefslogtreecommitdiff
path: root/spec/diff_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/diff_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/diff_spec.rb')
-rw-r--r--spec/diff_spec.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/spec/diff_spec.rb b/spec/diff_spec.rb
index 020ff44..e7d632a 100644
--- a/spec/diff_spec.rb
+++ b/spec/diff_spec.rb
@@ -1,33 +1,37 @@
-# -*- ruby encoding: utf-8 -*-
+# frozen_string_literal: true
require 'spec_helper'
-describe Diff::LCS, ".diff" do
+describe Diff::LCS, '.diff' do
include Diff::LCS::SpecHelper::Matchers
- it "correctly diffs seq1 to seq2" do
+ it 'correctly diffs seq1 to seq2' do
diff_s1_s2 = Diff::LCS.diff(seq1, seq2)
expect(change_diff(correct_forward_diff)).to eq(diff_s1_s2)
end
- it "correctly diffs seq2 to seq1" do
+ it 'correctly diffs seq2 to seq1' do
diff_s2_s1 = Diff::LCS.diff(seq2, seq1)
expect(change_diff(correct_backward_diff)).to eq(diff_s2_s1)
end
- it "correctly diffs against an empty sequence" do
+ it 'correctly diffs against an empty sequence' do
diff = Diff::LCS.diff(word_sequence, [])
correct_diff = [
- [ [ '-', 0, 'abcd' ],
- [ '-', 1, 'efgh' ],
- [ '-', 2, 'ijkl' ],
- [ '-', 3, 'mnopqrstuvwxyz' ] ]
+ [
+ ['-', 0, 'abcd'],
+ ['-', 1, 'efgh'],
+ ['-', 2, 'ijkl'],
+ ['-', 3, 'mnopqrstuvwxyz']
+ ]
]
expect(change_diff(correct_diff)).to eq(diff)
diff = Diff::LCS.diff([], word_sequence)
- correct_diff.each { |hunk| hunk.each { |change| change[0] = '+' } }
+ correct_diff.each do |hunk|
+ hunk.each do |change| change[0] = '+' end
+ end
expect(change_diff(correct_diff)).to eq(diff)
end
@@ -37,11 +41,11 @@ describe Diff::LCS, ".diff" do
expect(Diff::LCS.patch(left, Diff::LCS.diff(left, right))).to eq(right)
end
- it "returns an empty diff with (hello, hello)" do
+ it 'returns an empty diff with (hello, hello)' do
expect(Diff::LCS.diff(hello, hello)).to be_empty
end
- it "returns an empty diff with (hello_ary, hello_ary)" do
+ it 'returns an empty diff with (hello_ary, hello_ary)' do
expect(Diff::LCS.diff(hello_ary, hello_ary)).to be_empty
end
end