step 'I am a member of project "Shop"' do
@project = Project.find_by_name "Shop"
- @project ||= create(:project_with_code, name: "Shop")
+ @project ||= create(:project_with_code, name: "Shop", group: create(:group))
@project.team << [@user, :reporter]
end
page.should have_content "Name has already been taken"
end
-end
\ No newline at end of file
+end
# Create a project without caring about what it's called
And "I own a project" do
- @project = create(:project_with_code)
+ @project = create(:project_with_code, namespace: @user.namespace)
@project.team << [@user, :master]
end
# Create a specific project called "Shop"
And 'I own project "Shop"' do
@project = Project.find_by_name "Shop"
- @project ||= create(:project_with_code, name: "Shop")
+ @project ||= create(:project_with_code, name: "Shop", namespace: @user.namespace)
@project.team << [@user, :master]
end
factory :project_with_code, parent: :project do
path { 'gitlabhq' }
+
+ after :create do |project|
+ repos_path = Rails.root.join('tmp', 'test-git-base-path')
+ seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq')
+ target_repo = File.join(repos_path, project.path_with_namespace + '.git')
+ system("ln -s #{seed_repo} #{target_repo}")
+ end
end
factory :group do
describe "Search" do
before do
+ ActiveRecord::Base.observers.enable(:user_observer)
login_as :user
- @project = create(:project)
+ @project = create(:project, namespace: @user.namespace)
@project.team << [@user, :reporter]
visit search_path
let(:user2) { create(:user) }
let(:user3) { create(:user) }
let(:admin) { create(:admin) }
- let!(:project) { create(:project_with_code, creator_id: user.id) }
+ let!(:project) { create(:project_with_code, creator_id: user.id, namespace: user.namespace) }
let!(:hook) { create(:project_hook, project: project, url: "http://example.com") }
let!(:snippet) { create(:project_snippet, author: user, project: project, title: 'example') }
let!(:users_project) { create(:users_project, user: user, project: project, project_access: UsersProject::MASTER) }
end
end
-# edit_admin_project_member GET /admin/projects/:project_id/members/:id/edit(.:format) admin/projects/members#edit {id: /[^\/]+/, project_id: /[^\/]+/}
-# admin_project_member PUT /admin/projects/:project_id/members/:id(.:format) admin/projects/members#update {id: /[^\/]+/, project_id: /[^\/]+/}
# DELETE /admin/projects/:project_id/members/:id(.:format) admin/projects/members#destroy {id: /[^\/]+/, project_id: /[^\/]+/}
describe Admin::Projects::MembersController, "routing" do
- it "to #edit" do
- get("/admin/projects/test/members/1/edit").should route_to('admin/projects/members#edit', project_id: 'test', id: '1')
- end
-
- it "to #update" do
- put("/admin/projects/test/members/1").should route_to('admin/projects/members#update', project_id: 'test', id: '1')
- end
-
it "to #destroy" do
delete("/admin/projects/test/members/1").should route_to('admin/projects/members#destroy', project_id: 'test', id: '1')
end
# branches_project_repository GET /:project_id/repository/branches(.:format) repositories#branches
# tags_project_repository GET /:project_id/repository/tags(.:format) repositories#tags
# archive_project_repository GET /:project_id/repository/archive(.:format) repositories#archive
-# project_repository POST /:project_id/repository(.:format) repositories#create
-# new_project_repository GET /:project_id/repository/new(.:format) repositories#new
# edit_project_repository GET /:project_id/repository/edit(.:format) repositories#edit
-# GET /:project_id/repository(.:format) repositories#show
-# PUT /:project_id/repository(.:format) repositories#update
-# DELETE /:project_id/repository(.:format) repositories#destroy
describe RepositoriesController, "routing" do
it "to #branches" do
get("/gitlabhq/repository/branches").should route_to('repositories#branches', project_id: 'gitlabhq')
get("/gitlabhq/repository/archive").should route_to('repositories#archive', project_id: 'gitlabhq')
end
- it "to #create" do
- post("/gitlabhq/repository").should route_to('repositories#create', project_id: 'gitlabhq')
- end
-
- it "to #new" do
- get("/gitlabhq/repository/new").should route_to('repositories#new', project_id: 'gitlabhq')
- end
-
- it "to #edit" do
- get("/gitlabhq/repository/edit").should route_to('repositories#edit', project_id: 'gitlabhq')
- end
-
it "to #show" do
get("/gitlabhq/repository").should route_to('repositories#show', project_id: 'gitlabhq')
end
-
- it "to #update" do
- put("/gitlabhq/repository").should route_to('repositories#update', project_id: 'gitlabhq')
- end
-
- it "to #destroy" do
- delete("/gitlabhq/repository").should route_to('repositories#destroy', project_id: 'gitlabhq')
- end
end
# project_deploy_keys GET /:project_id/deploy_keys(.:format) deploy_keys#index
#
# role - User role (e.g., :admin, :user)
def login_as(role)
- @user = create(role)
+ ActiveRecord::Base.observers.enable(:user_observer) do
+ @user = create(role)
+ end
+
login_with(@user)
end
# Recreate tmp/test-git-base-path
FileUtils.mkdir_p Gitlab.config.gitlab_shell.repos_path
-
- # Symlink tmp/repositories/gitlabhq to tmp/test-git-base-path/gitlabhq
- seed_repo = Rails.root.join('tmp', 'repositories', 'gitlabhq')
- target_repo = File.join(repos_path, 'gitlabhq.git')
- system("ln -s #{seed_repo} #{target_repo}")
end
def create_temp_repo(path)