summaryrefslogtreecommitdiff
path: root/spec/frontend/fixtures/startup_css.rb
blob: 003f7b768ddeb966d2b1a5b2ed090dfad0071c35 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe 'Startup CSS fixtures', type: :controller do
  include JavaScriptFixturesHelpers

  let(:use_full_html) { true }

  render_views

  before(:all) do
    stub_feature_flags(combined_menu: true)
    stub_feature_flags(sidebar_refactor: true)
    clean_frontend_fixtures('startup_css/')
  end

  shared_examples 'startup css project fixtures' do |type|
    let(:user) { create(:user, :admin) }
    let(:project) { create(:project, :public, :repository, description: 'Code and stuff', creator: user) }

    before do
      sign_in(user)
    end

    it "startup_css/project-#{type}-legacy-menu.html" do
      stub_feature_flags(combined_menu: false)

      get :show, params: {
        namespace_id: project.namespace.to_param,
        id: project
      }

      expect(response).to be_successful
    end

    it "startup_css/project-#{type}.html" do
      get :show, params: {
        namespace_id: project.namespace.to_param,
        id: project
      }

      expect(response).to be_successful
    end

    it "startup_css/project-#{type}-legacy-sidebar.html" do
      stub_feature_flags(sidebar_refactor: false)

      get :show, params: {
        namespace_id: project.namespace.to_param,
        id: project
      }

      expect(response).to be_successful
    end

    it "startup_css/project-#{type}-signed-out.html" do
      sign_out(user)

      get :show, params: {
        namespace_id: project.namespace.to_param,
        id: project
      }

      expect(response).to be_successful
    end
  end

  describe ProjectsController, '(Startup CSS fixtures)', type: :controller do
    it_behaves_like 'startup css project fixtures', 'general'
  end

  describe ProjectsController, '(Startup CSS fixtures)', type: :controller do
    before do
      user.update!(theme_id: 11)
    end

    it_behaves_like 'startup css project fixtures', 'dark'
  end

  describe RegistrationsController, '(Startup CSS fixtures)', type: :controller do
    it 'startup_css/sign-in.html' do
      get :new

      expect(response).to be_successful
    end
  end
end