Commit 80097606 authored by Douwe Maan's avatar Douwe Maan

Make sure user has access to namespace in import tests.

parent 9193b94e
......@@ -27,37 +27,5 @@ module Gitlab
repo_list.to_s.split(',').map(&:strip).reject(&:blank?)
end
end
Repository = Struct.new(:full_name) do
def id
Digest::SHA1.hexdigest(full_name)
end
def namespace
segments.first
end
def path
segments.last
end
def name
path.titleize
end
def description
""
end
def import_url
"#{GITORIOUS_HOST}/#{full_name}.git"
end
private
def segments
full_name.split('/')
end
end
end
end
module Gitlab
module GitoriousImport
GITORIOUS_HOST = "https://gitorious.org"
Repository = Struct.new(:full_name) do
def id
Digest::SHA1.hexdigest(full_name)
end
def namespace
segments.first
end
def path
segments.last
end
def name
path.titleize
end
def description
""
end
def import_url
"#{GITORIOUS_HOST}/#{full_name}.git"
end
private
def segments
full_name.split('/')
end
end
end
end
......@@ -8,8 +8,12 @@ describe Gitlab::BitbucketImport::ProjectCreator do
is_private: true,
owner: "asd"}.with_indifferent_access
}
let(:namespace){ create(:namespace) }
let(:namespace){ create(:group, owner: user) }
before do
namespace.add_owner(user)
end
it 'creates project' do
allow_any_instance_of(Project).to receive(:add_import_job)
......
......@@ -10,7 +10,11 @@ describe Gitlab::GithubImport::ProjectCreator do
clone_url: "https://gitlab.com/asd/vim.git",
owner: OpenStruct.new(login: "john"))
}
let(:namespace){ create(:namespace) }
let(:namespace){ create(:group, owner: user) }
before do
namespace.add_owner(user)
end
it 'creates project' do
allow_any_instance_of(Project).to receive(:add_import_job)
......
......@@ -10,7 +10,11 @@ describe Gitlab::GitlabImport::ProjectCreator do
http_url_to_repo: "https://gitlab.com/asd/vim.git",
owner: {name: "john"}}.with_indifferent_access
}
let(:namespace){ create(:namespace) }
let(:namespace){ create(:group, owner: user) }
before do
namespace.add_owner(user)
end
it 'creates project' do
allow_any_instance_of(Project).to receive(:add_import_job)
......
......@@ -3,7 +3,11 @@ require 'spec_helper'
describe Gitlab::GitoriousImport::ProjectCreator do
let(:user) { create(:user) }
let(:repo) { Gitlab::GitoriousImport::Repository.new('foo/bar-baz-qux') }
let(:namespace){ create(:namespace) }
let(:namespace){ create(:group, owner: user) }
before do
namespace.add_owner(user)
end
it 'creates project' do
allow_any_instance_of(Project).to receive(:add_import_job)
......
......@@ -9,7 +9,11 @@ describe Gitlab::GoogleCodeImport::ProjectCreator do
"repositoryUrls" => [ "https://vim.googlecode.com/git/" ]
)
}
let(:namespace) { create(:namespace) }
let(:namespace){ create(:group, owner: user) }
before do
namespace.add_owner(user)
end
it 'creates project' do
allow_any_instance_of(Project).to receive(:add_import_job)
......
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