2021-06-01 14:10:04 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Startup CSS fixtures', type: :controller do
|
|
|
|
include JavaScriptFixturesHelpers
|
|
|
|
|
|
|
|
let(:use_full_html) { true }
|
|
|
|
|
|
|
|
render_views
|
|
|
|
|
|
|
|
shared_examples 'startup css project fixtures' do |type|
|
|
|
|
let(:user) { create(:user, :admin) }
|
2021-06-03 14:09:58 -04:00
|
|
|
let(:project) { create(:project, :public, :repository, description: 'Code and stuff', creator: user) }
|
2021-06-01 14:10:04 -04:00
|
|
|
|
|
|
|
before do
|
2021-09-29 05:11:43 -04:00
|
|
|
# We want vNext badge to be included and com/canary don't remove/hide any other elements.
|
|
|
|
# This is why we're turning com and canary on by default for now.
|
|
|
|
allow(Gitlab).to receive(:com?).and_return(true)
|
|
|
|
allow(Gitlab).to receive(:canary?).and_return(true)
|
2021-06-01 14:10:04 -04:00
|
|
|
sign_in(user)
|
|
|
|
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}-signed-out.html" do
|
|
|
|
sign_out(user)
|
|
|
|
|
|
|
|
get :show, params: {
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
id: project
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2021-09-06 21:02:14 -04:00
|
|
|
|
2022-03-28 05:07:06 -04:00
|
|
|
# This Feature Flag is on by default
|
2021-09-06 21:02:14 -04:00
|
|
|
# This ensures that the correct css is generated
|
2022-03-28 05:07:06 -04:00
|
|
|
# When the feature flag is on, the general startup will capture it
|
2021-09-06 21:02:14 -04:00
|
|
|
# This will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/339348
|
2022-03-28 05:07:06 -04:00
|
|
|
it "startup_css/project-#{type}-search-ff-off.html" do
|
|
|
|
stub_feature_flags(new_header_search: false)
|
2021-09-06 21:02:14 -04:00
|
|
|
|
|
|
|
get :show, params: {
|
|
|
|
namespace_id: project.namespace.to_param,
|
|
|
|
id: project
|
|
|
|
}
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2021-06-01 14:10:04 -04:00
|
|
|
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
|
|
|
|
|
2022-09-09 11:13:16 -04:00
|
|
|
describe SessionsController, '(Startup CSS fixtures)', type: :controller do
|
|
|
|
include DeviseHelpers
|
|
|
|
|
|
|
|
before do
|
|
|
|
set_devise_mapping(context: request)
|
|
|
|
end
|
|
|
|
|
2021-06-01 14:10:04 -04:00
|
|
|
it 'startup_css/sign-in.html' do
|
|
|
|
get :new
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2022-09-09 11:13:16 -04:00
|
|
|
|
|
|
|
it 'startup_css/sign-in-old.html' do
|
|
|
|
stub_feature_flags(restyle_login_page: false)
|
|
|
|
|
|
|
|
get :new
|
|
|
|
|
|
|
|
expect(response).to be_successful
|
|
|
|
end
|
2021-06-01 14:10:04 -04:00
|
|
|
end
|
|
|
|
end
|