remove useless routing tests. Added symlink creation for project with code

This commit is contained in:
Dmitriy Zaporozhets 2013-06-22 18:57:34 +03:00
parent 248ece76e5
commit e45179c9b4
9 changed files with 18 additions and 47 deletions

View file

@ -10,7 +10,7 @@ class ForkProject < Spinach::FeatureSteps
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
@ -27,4 +27,4 @@ class ForkProject < Spinach::FeatureSteps
page.should have_content "Name has already been taken"
end
end
end

View file

@ -3,14 +3,14 @@ module SharedProject
# 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

View file

@ -36,6 +36,13 @@ FactoryGirl.define do
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

View file

@ -2,8 +2,9 @@ require 'spec_helper'
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

View file

@ -8,7 +8,7 @@ describe API::API do
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) }

View file

@ -75,18 +75,8 @@ describe Admin::ProjectsController, "routing" do
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

View file

@ -124,12 +124,7 @@ 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')
@ -143,29 +138,9 @@ describe RepositoriesController, "routing" do
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

View file

@ -3,7 +3,10 @@ module LoginHelpers
#
# 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

View file

@ -65,11 +65,6 @@ module TestEnv
# 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)