Welcome to mirror list, hosted at ThFree Co, Russian Federation.

image_formatter_spec.rb « formatters « diff « gitlab « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: edf30ffc56f2dd0d467a44fc1461ec408abf0b8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

require 'spec_helper'

describe Gitlab::Diff::Formatters::ImageFormatter do
  let(:base_attrs) do
    {
      base_sha: 123,
      start_sha: 456,
      head_sha: 789,
      old_path: 'old_image.png',
      new_path: 'new_image.png',
      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

      it { is_expected.not_to eq(other_formatter) }
    end
  end
end