Commit a0719cb4 authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Use `let_it_be` for Static Site Editor tests

parent 1d1c40f9
......@@ -3,7 +3,8 @@
require 'spec_helper'
describe Projects::StaticSiteEditorController do
let(:project) { create(:project, :public, :repository) }
let_it_be(:project) { create(:project, :public, :repository) }
let_it_be(:user) { create(:user) }
describe 'GET show' do
let(:default_params) do
......@@ -27,8 +28,6 @@ describe Projects::StaticSiteEditorController do
end
context 'as guest' do
let(:user) { create(:user) }
before do
project.add_guest(user)
sign_in(user)
......@@ -42,10 +41,11 @@ describe Projects::StaticSiteEditorController do
%w[developer maintainer].each do |role|
context "as #{role}" do
let(:user) { create(:user) }
before_all do
project.add_role(user, role)
end
before do
project.add_role(user, role)
sign_in(user)
get :show, params: default_params
end
......@@ -54,11 +54,8 @@ describe Projects::StaticSiteEditorController do
expect(response).to render_template(:show)
end
it 'assigns a config variable' do
it 'assigns a required variables' do
expect(assigns(:config)).to be_a(Gitlab::StaticSiteEditor::Config)
end
it 'correctly assigns ref and path' do
expect(assigns(:ref)).to eq('master')
expect(assigns(:path)).to eq('README.md')
end
......
......@@ -3,8 +3,8 @@
require 'spec_helper'
describe 'Static Site Editor' do
let(:user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
let_it_be(:user) { create(:user) }
let_it_be(:project) { create(:project, :public, :repository) }
before do
project.add_maintainer(user)
......
......@@ -6,7 +6,7 @@ describe 'Creation of a new branch' do
include GraphqlHelpers
let_it_be(:current_user) { create(:user) }
let(:project) { create(:project, :public, :repository) }
let_it_be(:project) { create(:project, :public, :empty_repo) }
let(:input) { { project_path: project.full_path, name: new_branch, ref: ref } }
let(:new_branch) { 'new_branch' }
let(:ref) { 'master' }
......@@ -35,6 +35,7 @@ describe 'Creation of a new branch' do
end
context 'when ref is not correct' do
let(:new_branch) { 'another_branch' }
let(:ref) { 'unknown' }
it_behaves_like 'a mutation that returns errors in the response',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment