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

item_presenter_spec.rb « whats_new « gitlab « presenters « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9b04741aa60df39df6398c93b3e623035caf0954 (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
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Gitlab::WhatsNew::ItemPresenter do
  let(:present) { Gitlab::WhatsNew::ItemPresenter.present(item) }
  let(:item) { { "packages" => %w(Core Starter Premium Ultimate) } }
  let(:gitlab_com) { true }

  before do
    allow(Gitlab).to receive(:com?).and_return(gitlab_com)
  end

  describe '.present' do
    context 'when on Gitlab.com' do
      it 'transforms package names to gitlab.com friendly package names' do
        expect(present).to eq({ "packages" => %w(Free Bronze Silver Gold) })
      end
    end

    context 'when not on Gitlab.com' do
      let(:gitlab_com) { false }

      it 'does not transform package names' do
        expect(present).to eq({ "packages" => %w(Core Starter Premium Ultimate) })
      end
    end
  end
end