debian-mirror-gitlab/spec/lib/gitlab/diff/formatters/image_formatter_spec.rb

38 lines
782 B
Ruby
Raw Normal View History

2019-10-12 21:52:04 +05:30
# frozen_string_literal: true
2018-03-17 18:26:18 +05:30
require 'spec_helper'
2020-07-28 23:09:34 +05:30
RSpec.describe Gitlab::Diff::Formatters::ImageFormatter do
2020-03-13 15:44:24 +05:30
let(:base_attrs) do
{
base_sha: 123,
start_sha: 456,
head_sha: 789,
old_path: 'old_image.png',
new_path: 'new_image.png',
2020-06-23 00:09:42 +05:30
file_identifier_hash: '777',
2020-03-13 15:44:24 +05:30
position_type: 'image'
}
end
let(:attrs) do
base_attrs.merge(width: 100, height: 100, x: 1, y: 2)
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
2018-03-17 18:26:18 +05:30
2020-03-13 15:44:24 +05:30
it { is_expected.not_to eq(other_formatter) }
2018-03-17 18:26:18 +05:30
end
end
end