Commit 0d3380ab authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'rs-empty_project-controllers' into 'master'

Use `:empty_project` where possible in controller specs

See merge request !8797
parents 6d2fa87d 4642ca66
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Admin::GroupsController do describe Admin::GroupsController do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:empty_project, namespace: group) }
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Admin::ProjectsController do describe Admin::ProjectsController do
let!(:project) { create(:project, visibility_level: Gitlab::VisibilityLevel::PUBLIC) } let!(:project) { create(:empty_project, :public) }
before do before do
sign_in(create(:admin)) sign_in(create(:admin))
......
require 'spec_helper' require 'spec_helper'
describe AutocompleteController do describe AutocompleteController do
let!(:project) { create(:project) } let!(:project) { create(:empty_project) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
context 'GET users' do context 'GET users' do
......
require 'spec_helper' require 'spec_helper'
describe Projects::BlobController do describe Projects::BlobController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Ci::ProjectsController do describe Ci::ProjectsController do
let(:visibility) { :public } let(:visibility) { :public }
let!(:project) { create(:project, visibility, ci_id: 1) } let!(:project) { create(:empty_project, visibility, ci_id: 1) }
let(:ci_id) { project.ci_id } let(:ci_id) { project.ci_id }
describe '#index' do describe '#index' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Dashboard::TodosController do describe Dashboard::TodosController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:todo_service) { TodoService.new } let(:todo_service) { TodoService.new }
describe 'GET #index' do describe 'GET #index' do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Groups::MilestonesController do describe Groups::MilestonesController do
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, group: group) } let(:project) { create(:empty_project, group: group) }
let(:project2) { create(:empty_project, group: group) } let(:project2) { create(:empty_project, group: group) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:title) { '肯定不是中文的问题' } let(:title) { '肯定不是中文的问题' }
......
...@@ -3,7 +3,7 @@ require 'rails_helper' ...@@ -3,7 +3,7 @@ require 'rails_helper'
describe GroupsController do describe GroupsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:group) { create(:group) } let(:group) { create(:group) }
let(:project) { create(:project, namespace: group) } let(:project) { create(:empty_project, namespace: group) }
let!(:group_member) { create(:group_member, group: group, user: user) } let!(:group_member) { create(:group_member, group: group, user: user) }
describe 'GET #index' do describe 'GET #index' do
......
...@@ -52,7 +52,7 @@ describe Import::BitbucketController do ...@@ -52,7 +52,7 @@ describe Import::BitbucketController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:project, import_type: 'bitbucket', creator_id: user.id) @project = create(:empty_project, import_type: 'bitbucket', creator_id: user.id)
allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo]) allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo])
get :status get :status
...@@ -63,7 +63,7 @@ describe Import::BitbucketController do ...@@ -63,7 +63,7 @@ describe Import::BitbucketController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:project, import_type: 'bitbucket', creator_id: user.id, import_source: 'asd/vim') @project = create(:empty_project, import_type: 'bitbucket', creator_id: user.id, import_source: 'asd/vim')
allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo]) allow_any_instance_of(Bitbucket::Client).to receive(:repos).and_return([@repo])
get :status get :status
......
...@@ -16,7 +16,7 @@ describe Import::FogbugzController do ...@@ -16,7 +16,7 @@ describe Import::FogbugzController do
end end
it 'assigns variables' do it 'assigns variables' do
@project = create(:project, import_type: 'fogbugz', creator_id: user.id) @project = create(:empty_project, import_type: 'fogbugz', creator_id: user.id)
stub_client(repos: [@repo]) stub_client(repos: [@repo])
get :status get :status
...@@ -26,7 +26,7 @@ describe Import::FogbugzController do ...@@ -26,7 +26,7 @@ describe Import::FogbugzController do
end end
it 'does not show already added project' do it 'does not show already added project' do
@project = create(:project, import_type: 'fogbugz', creator_id: user.id, import_source: 'vim') @project = create(:empty_project, import_type: 'fogbugz', creator_id: user.id, import_source: 'vim')
stub_client(repos: [@repo]) stub_client(repos: [@repo])
get :status get :status
......
...@@ -36,7 +36,7 @@ describe Import::GitlabController do ...@@ -36,7 +36,7 @@ describe Import::GitlabController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:project, import_type: 'gitlab', creator_id: user.id) @project = create(:empty_project, import_type: 'gitlab', creator_id: user.id)
stub_client(projects: [@repo]) stub_client(projects: [@repo])
get :status get :status
...@@ -46,7 +46,7 @@ describe Import::GitlabController do ...@@ -46,7 +46,7 @@ describe Import::GitlabController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim') @project = create(:empty_project, import_type: 'gitlab', creator_id: user.id, import_source: 'asd/vim')
stub_client(projects: [@repo]) stub_client(projects: [@repo])
get :status get :status
......
...@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do ...@@ -27,7 +27,7 @@ describe Import::GoogleCodeController do
end end
it "assigns variables" do it "assigns variables" do
@project = create(:project, import_type: 'google_code', creator_id: user.id) @project = create(:empty_project, import_type: 'google_code', creator_id: user.id)
stub_client(repos: [@repo], incompatible_repos: []) stub_client(repos: [@repo], incompatible_repos: [])
get :status get :status
...@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do ...@@ -38,7 +38,7 @@ describe Import::GoogleCodeController do
end end
it "does not show already added project" do it "does not show already added project" do
@project = create(:project, import_type: 'google_code', creator_id: user.id, import_source: 'vim') @project = create(:empty_project, import_type: 'google_code', creator_id: user.id, import_source: 'vim')
stub_client(repos: [@repo], incompatible_repos: []) stub_client(repos: [@repo], incompatible_repos: [])
get :status get :status
......
...@@ -93,7 +93,7 @@ describe NotificationSettingsController do ...@@ -93,7 +93,7 @@ describe NotificationSettingsController do
end end
context 'not authorized' do context 'not authorized' do
let(:private_project) { create(:project, :private) } let(:private_project) { create(:empty_project, :private) }
before { sign_in(user) } before { sign_in(user) }
it 'returns 404' do it 'returns 404' do
......
require 'spec_helper' require 'spec_helper'
describe Projects::AvatarsController do describe Projects::AvatarsController do
let(:project) { create(:project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) } let(:project) { create(:empty_project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::BlameController do describe Projects::BlameController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'rails_helper' require 'rails_helper'
describe Projects::BlobController do describe Projects::BlobController do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::BranchesController do describe Projects::BranchesController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:developer) { create(:user) } let(:developer) { create(:user) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::CommitController do describe Projects::CommitController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:commit) { project.commit("master") } let(:commit) { project.commit("master") }
let(:pipeline) { create(:ci_pipeline, project: project, commit: commit) } let(:pipeline) { create(:ci_pipeline, project: project, commit: commit) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::CommitsController do describe Projects::CommitsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::CompareController do describe Projects::CompareController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:ref_from) { "improve%2Fawesome" } let(:ref_from) { "improve%2Fawesome" }
let(:ref_to) { "feature" } let(:ref_to) { "feature" }
......
require 'spec_helper' require 'spec_helper'
describe Projects::CycleAnalyticsController do describe Projects::CycleAnalyticsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::DiscussionsController do describe Projects::DiscussionsController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:merge_request) { create(:merge_request) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:project) { merge_request.source_project }
let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) } let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
let(:discussion) { note.discussion } let(:discussion) { note.discussion }
......
require 'spec_helper' require 'spec_helper'
describe Projects::FindFileController do describe Projects::FindFileController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::ForksController do describe Projects::ForksController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let(:forked_project) { Projects::ForkService.new(project, user).execute } let(:forked_project) { Projects::ForkService.new(project, user).execute }
let(:group) { create(:group, owner: forked_project.creator) } let(:group) { create(:group, owner: forked_project.creator) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::GraphsController do describe Projects::GraphsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -3,7 +3,7 @@ require 'spec_helper' ...@@ -3,7 +3,7 @@ require 'spec_helper'
describe Projects::GroupLinksController do describe Projects::GroupLinksController do
let(:group) { create(:group, :private) } let(:group) { create(:group, :private) }
let(:group2) { create(:group, :private) } let(:group2) { create(:group, :private) }
let(:project) { create(:project, :private, group: group2) } let(:project) { create(:empty_project, :private, group: group2) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
...@@ -98,7 +98,7 @@ describe Projects::IssuesController do ...@@ -98,7 +98,7 @@ describe Projects::IssuesController do
end end
it 'fills in an issue for a merge request' do it 'fills in an issue for a merge request' do
project_with_repository = create(:project) project_with_repository = create(:project, :repository)
project_with_repository.team << [user, :developer] project_with_repository.team << [user, :developer]
mr = create(:merge_request_with_diff_notes, source_project: project_with_repository) mr = create(:merge_request_with_diff_notes, source_project: project_with_repository)
...@@ -124,7 +124,7 @@ describe Projects::IssuesController do ...@@ -124,7 +124,7 @@ describe Projects::IssuesController do
describe 'PUT #update' do describe 'PUT #update' do
context 'when moving issue to another private project' do context 'when moving issue to another private project' do
let(:another_project) { create(:project, :private) } let(:another_project) { create(:empty_project, :private) }
before do before do
sign_in(user) sign_in(user)
...@@ -466,7 +466,7 @@ describe Projects::IssuesController do ...@@ -466,7 +466,7 @@ describe Projects::IssuesController do
context "when the user is owner" do context "when the user is owner" do
let(:owner) { create(:user) } let(:owner) { create(:user) }
let(:namespace) { create(:namespace, owner: owner) } let(:namespace) { create(:namespace, owner: owner) }
let(:project) { create(:project, namespace: namespace) } let(:project) { create(:empty_project, namespace: namespace) }
before { sign_in(owner) } before { sign_in(owner) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::MilestonesController do describe Projects::MilestonesController do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:milestone) { create(:milestone, project: project) } let(:milestone) { create(:milestone, project: project) }
let(:issue) { create(:issue, project: project, milestone: milestone) } let(:issue) { create(:issue, project: project, milestone: milestone) }
......
...@@ -2,7 +2,7 @@ require 'spec_helper' ...@@ -2,7 +2,7 @@ require 'spec_helper'
describe Projects::NotesController do describe Projects::NotesController do
let(:user) { create(:user) } let(:user) { create(:user) }
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:issue) { create(:issue, project: project) } let(:issue) { create(:issue, project: project) }
let(:note) { create(:note, noteable: issue, project: project) } let(:note) { create(:note, noteable: issue, project: project) }
...@@ -16,6 +16,7 @@ describe Projects::NotesController do ...@@ -16,6 +16,7 @@ describe Projects::NotesController do
describe 'POST create' do describe 'POST create' do
let(:merge_request) { create(:merge_request) } let(:merge_request) { create(:merge_request) }
let(:project) { merge_request.source_project }
let(:request_params) do let(:request_params) do
{ {
note: { note: 'some note', noteable_id: merge_request.id, noteable_type: 'MergeRequest' }, note: { note: 'some note', noteable_id: merge_request.id, noteable_type: 'MergeRequest' },
...@@ -88,6 +89,7 @@ describe Projects::NotesController do ...@@ -88,6 +89,7 @@ describe Projects::NotesController do
end end
describe "resolving and unresolving" do describe "resolving and unresolving" do
let(:project) { create(:project, :repository) }
let(:merge_request) { create(:merge_request, source_project: project) } let(:merge_request) { create(:merge_request, source_project: project) }
let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) } let(:note) { create(:diff_note_on_merge_request, noteable: merge_request, project: project) }
......
...@@ -143,7 +143,7 @@ describe Projects::ProjectMembersController do ...@@ -143,7 +143,7 @@ describe Projects::ProjectMembersController do
end end
context 'and is an owner' do context 'and is an owner' do
let(:project) { create(:project, namespace: user.namespace) } let(:project) { create(:empty_project, namespace: user.namespace) }
before { project.team << [user, :master] } before { project.team << [user, :master] }
...@@ -234,7 +234,7 @@ describe Projects::ProjectMembersController do ...@@ -234,7 +234,7 @@ describe Projects::ProjectMembersController do
end end
describe 'POST apply_import' do describe 'POST apply_import' do
let(:another_project) { create(:project, :private) } let(:another_project) { create(:empty_project, :private) }
let(:member) { create(:user) } let(:member) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::RawController do describe Projects::RawController do
let(:public_project) { create(:project, :public) } let(:public_project) { create(:project, :public, :repository) }
describe "#show" do describe "#show" do
context 'regular filename' do context 'regular filename' do
......
require 'spec_helper' require 'spec_helper'
describe Projects::RefsController do describe Projects::RefsController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::ReleasesController do describe Projects::ReleasesController do
let!(:project) { create(:project) } let!(:project) { create(:project, :repository) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:release) { create(:release, project: project) } let!(:release) { create(:release, project: project) }
let!(:tag) { release.tag } let!(:tag) { release.tag }
......
require "spec_helper" require "spec_helper"
describe Projects::RepositoriesController do describe Projects::RepositoriesController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
describe "GET archive" do describe "GET archive" do
context 'as a guest' do context 'as a guest' do
......
require 'spec_helper' require 'spec_helper'
describe Projects::ServicesController do describe Projects::ServicesController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:service) { create(:service, project: project) } let(:service) { create(:service, project: project) }
......
require 'spec_helper' require 'spec_helper'
describe Projects::Settings::IntegrationsController do describe Projects::Settings::IntegrationsController do
let(:project) { create(:project, :public) } let(:project) { create(:empty_project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require 'spec_helper' require 'spec_helper'
describe Projects::TagsController do describe Projects::TagsController do
let(:project) { create(:project, :public) } let(:project) { create(:project, :public, :repository) }
let!(:release) { create(:release, project: project) } let!(:release) { create(:release, project: project) }
let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') } let!(:invalid_release) { create(:release, project: project, tag: 'does-not-exist') }
......
require 'spec_helper' require 'spec_helper'
describe Projects::TemplatesController do describe Projects::TemplatesController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:user2) { create(:user) } let(:user2) { create(:user) }
let(:file_path_1) { '.gitlab/issue_templates/bug.md' } let(:file_path_1) { '.gitlab/issue_templates/bug.md' }
......
require 'spec_helper' require 'spec_helper'
describe Projects::TreeController do describe Projects::TreeController do
let(:project) { create(:project) } let(:project) { create(:project, :repository) }
let(:user) { create(:user) } let(:user) { create(:user) }
before do before do
......
require('spec_helper') require('spec_helper')
describe Projects::UploadsController do describe Projects::UploadsController do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') }
let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') }
......
require('spec_helper') require('spec_helper')
describe ProjectsController do describe ProjectsController do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:public_project) { create(:project, :public) } let(:public_project) { create(:empty_project, :public) }
let(:user) { create(:user) } let(:user) { create(:user) }
let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') } let(:jpg) { fixture_file_upload(Rails.root + 'spec/fixtures/rails_sample.jpg', 'image/jpg') }
let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') } let(:txt) { fixture_file_upload(Rails.root + 'spec/fixtures/doc_sample.txt', 'text/plain') }
describe 'GET index' do describe 'GET index' do
context 'as a user' do context 'as a user' do
...@@ -32,7 +32,7 @@ describe ProjectsController do ...@@ -32,7 +32,7 @@ describe ProjectsController do
before { sign_in(user) } before { sign_in(user) }
context "user does not have access to project" do context "user does not have access to project" do
let(:private_project) { create(:project, :private) } let(:private_project) { create(:empty_project, :private) }
it "does not initialize notification setting" do it "does not initialize notification setting" do
get :show, namespace_id: private_project.namespace.path, id: private_project.path get :show, namespace_id: private_project.namespace.path, id: private_project.path
...@@ -146,6 +146,8 @@ describe ProjectsController do ...@@ -146,6 +146,8 @@ describe ProjectsController do
end end
context "rendering default project view" do context "rendering default project view" do
let(:public_project) { create(:project, :public, :repository) }
render_views render_views
it "renders the activity view" do it "renders the activity view" do
...@@ -190,25 +192,11 @@ describe ProjectsController do ...@@ -190,25 +192,11 @@ describe ProjectsController do
expect(assigns(:project)).to eq(public_project) expect(assigns(:project)).to eq(public_project)
expect(response).to redirect_to("/#{public_project.path_with_namespace}") expect(response).to redirect_to("/#{public_project.path_with_namespace}")
end end
# MySQL queries are case insensitive by default, so this spec would fail.
if Gitlab::Database.postgresql?
context "when there is also a match with the same casing" do
let!(:other_project) { create(:project, :public, namespace: public_project.namespace, path: public_project.path.upcase) }
it "loads the exactly matched project" do
get :show, namespace_id: public_project.namespace.path, id: public_project.path.upcase
expect(assigns(:project)).to eq(other_project)
expect(response).to have_http_status(200)
end
end
end
end end
end end
context "when the url contains .atom" do context "when the url contains .atom" do
let(:public_project_with_dot_atom) { build(:project, :public, name: 'my.atom', path: 'my.atom') } let(:public_project_with_dot_atom) { build(:empty_project, :public, name: 'my.atom', path: 'my.atom') }
it 'expects an error creating the project' do it 'expects an error creating the project' do
expect(public_project_with_dot_atom).not_to be_valid expect(public_project_with_dot_atom).not_to be_valid
...@@ -217,7 +205,7 @@ describe ProjectsController do ...@@ -217,7 +205,7 @@ describe ProjectsController do
context 'when the project is pending deletions' do context 'when the project is pending deletions' do
it 'renders a 404 error' do it 'renders a 404 error' do
project = create(:project, pending_delete: true) project = create(:empty_project, pending_delete: true)
sign_in(user) sign_in(user)
get :show, namespace_id: project.namespace.path, id: project.path get :show, namespace_id: project.namespace.path, id: project.path
...@@ -233,6 +221,7 @@ describe ProjectsController do ...@@ -233,6 +221,7 @@ describe ProjectsController do
let(:admin) { create(:admin) } let(:admin) { create(:admin) }
it "sets the repository to the right path after a rename" do it "sets the repository to the right path after a rename" do
project = create(:project, :repository)
new_path = 'renamed_path' new_path = 'renamed_path'
project_params = { path: new_path } project_params = { path: new_path }
controller.instance_variable_set(:@project, project) controller.instance_variable_set(:@project, project)
...@@ -384,6 +373,8 @@ describe ProjectsController do ...@@ -384,6 +373,8 @@ describe ProjectsController do
end end
describe "GET refs" do describe "GET refs" do
let(:public_project) { create(:project, :public) }
it "gets a list of branches and tags" do it "gets a list of branches and tags" do
get :refs, namespace_id: public_project.namespace.path, id: public_project.path get :refs, namespace_id: public_project.namespace.path, id: public_project.path
......
...@@ -41,7 +41,7 @@ describe UploadsController do ...@@ -41,7 +41,7 @@ describe UploadsController do
end end
context "when viewing a project avatar" do context "when viewing a project avatar" do
let!(:project) { create(:project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) } let!(:project) { create(:empty_project, avatar: fixture_file_upload(Rails.root + "spec/fixtures/dk.png", "image/png")) }
context "when the project is public" do context "when the project is public" do
before do before do
......
...@@ -73,7 +73,7 @@ describe UsersController do ...@@ -73,7 +73,7 @@ describe UsersController do
end end
context 'forked project' do context 'forked project' do
let(:project) { create(:project) } let(:project) { create(:empty_project) }
let(:forked_project) { Projects::ForkService.new(project, user).execute } let(:forked_project) { Projects::ForkService.new(project, user).execute }
before do before do
...@@ -91,7 +91,7 @@ describe UsersController do ...@@ -91,7 +91,7 @@ describe UsersController do
end end
describe 'GET #calendar_activities' do describe 'GET #calendar_activities' do
let!(:project) { create(:project) } let!(:project) { create(:empty_project) }
let!(:user) { create(:user) } let!(:user) { create(:user) }
before do before do
......
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