Commit bb43a021 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'ld-image-formatter-eql-for-width-and-height' into 'master'

Allow ImageFormatter#== to factor width and height

See merge request gitlab-org/gitlab!24126
parents a6fae82d 73c9dee8
...@@ -37,7 +37,9 @@ module Gitlab ...@@ -37,7 +37,9 @@ module Gitlab
def ==(other) def ==(other)
other.is_a?(self.class) && other.is_a?(self.class) &&
x == other.x && x == other.x &&
y == other.y y == other.y &&
width == other.width &&
height == other.height
end end
end end
end end
......
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
require 'spec_helper' require 'spec_helper'
describe Gitlab::Diff::Formatters::ImageFormatter do describe Gitlab::Diff::Formatters::ImageFormatter do
it_behaves_like "position formatter" do
let(:base_attrs) do let(:base_attrs) do
{ {
base_sha: 123, base_sha: 123,
...@@ -18,5 +17,20 @@ describe Gitlab::Diff::Formatters::ImageFormatter do ...@@ -18,5 +17,20 @@ describe Gitlab::Diff::Formatters::ImageFormatter do
let(:attrs) do let(:attrs) do
base_attrs.merge(width: 100, height: 100, x: 1, y: 2) base_attrs.merge(width: 100, height: 100, x: 1, y: 2)
end end
it_behaves_like 'position formatter'
describe '#==' do
subject { described_class.new(attrs) }
it { is_expected.to eq(subject) }
[:width, :height, :x, :y].each do |attr|
let(:other_formatter) do
described_class.new(attrs.merge(attr => 9))
end
it { is_expected.not_to eq(other_formatter) }
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment