summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2015-04-15 15:56:23 +0000
committerMarin Jankovski <marin@gitlab.com>2015-04-15 15:56:23 +0000
commit5f78601c8a67028f246134d325cca99952ba78b6 (patch)
tree3de7a45fc5be22e061d85ed888f54dde74099d82
parent9193b94ecec58c7c386f9c1b5a6f06f01b1ef42a (diff)
parent80097606f59c52ab962a3bec1e67f67d1a3cb6c7 (diff)
downloadgitlab-ce-5f78601c8a67028f246134d325cca99952ba78b6.tar.gz
Merge branch 'fix-gitorious-test' into 'master'
Make sure user has access to namespace in import tests. See merge request !529
-rw-r--r--lib/gitlab/gitorious_import/client.rb32
-rw-r--r--lib/gitlab/gitorious_import/repository.rb37
-rw-r--r--spec/lib/gitlab/bitbucket_import/project_creator_spec.rb6
-rw-r--r--spec/lib/gitlab/github_import/project_creator_spec.rb6
-rw-r--r--spec/lib/gitlab/gitlab_import/project_creator_spec.rb6
-rw-r--r--spec/lib/gitlab/gitorious_import/project_creator_spec.rb6
-rw-r--r--spec/lib/gitlab/google_code_import/project_creator_spec.rb6
7 files changed, 62 insertions, 37 deletions
diff --git a/lib/gitlab/gitorious_import/client.rb b/lib/gitlab/gitorious_import/client.rb
index 5043f6a2ebd..8cdc3d4afae 100644
--- a/lib/gitlab/gitorious_import/client.rb
+++ b/lib/gitlab/gitorious_import/client.rb
@@ -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
diff --git a/lib/gitlab/gitorious_import/repository.rb b/lib/gitlab/gitorious_import/repository.rb
new file mode 100644
index 00000000000..f702797dc6e
--- /dev/null
+++ b/lib/gitlab/gitorious_import/repository.rb
@@ -0,0 +1,37 @@
+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
diff --git a/spec/lib/gitlab/bitbucket_import/project_creator_spec.rb b/spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
index f5523105848..0ec6a43f681 100644
--- a/spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/bitbucket_import/project_creator_spec.rb
@@ -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)
diff --git a/spec/lib/gitlab/github_import/project_creator_spec.rb b/spec/lib/gitlab/github_import/project_creator_spec.rb
index 8d594a112d4..3bf52cb685e 100644
--- a/spec/lib/gitlab/github_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/github_import/project_creator_spec.rb
@@ -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)
diff --git a/spec/lib/gitlab/gitlab_import/project_creator_spec.rb b/spec/lib/gitlab/gitlab_import/project_creator_spec.rb
index 4c0d64ed138..3cefe4ea8e2 100644
--- a/spec/lib/gitlab/gitlab_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/gitlab_import/project_creator_spec.rb
@@ -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)
diff --git a/spec/lib/gitlab/gitorious_import/project_creator_spec.rb b/spec/lib/gitlab/gitorious_import/project_creator_spec.rb
index 90271ea15e3..c1125ca6357 100644
--- a/spec/lib/gitlab/gitorious_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/gitorious_import/project_creator_spec.rb
@@ -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)
diff --git a/spec/lib/gitlab/google_code_import/project_creator_spec.rb b/spec/lib/gitlab/google_code_import/project_creator_spec.rb
index 6cdd4dbbfb1..7a224538b8b 100644
--- a/spec/lib/gitlab/google_code_import/project_creator_spec.rb
+++ b/spec/lib/gitlab/google_code_import/project_creator_spec.rb
@@ -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)