BigW Consortium Gitlab

_project.html.haml_spec.rb 972 Bytes
Newer Older
1 2 3 4 5 6 7
require 'spec_helper'

describe 'layouts/nav/_project' do
  describe 'container registry tab' do
    before do
      stub_container_registry_config(enabled: true)

8
      assign(:project, create(:project, :repository))
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 37
      allow(view).to receive(:current_ref).and_return('master')

      allow(view).to receive(:can?).and_return(true)
      allow(controller).to receive(:controller_name)
        .and_return('repositories')
      allow(controller).to receive(:controller_path)
        .and_return('projects/registry/repositories')
    end

    it 'has both Registry and Repository tabs' do
      render

      expect(rendered).to have_text 'Repository'
      expect(rendered).to have_text 'Registry'
    end

    it 'highlights only one tab' do
      render

      expect(rendered).to have_css('.active', count: 1)
    end

    it 'highlights container registry tab only' do
      render

      expect(rendered).to have_css('.active', text: 'Registry')
    end
  end
end