diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-22 18:57:34 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-06-22 18:57:34 +0300 |
commit | e45179c9b4d0504def48f00cfe4b97463b090614 (patch) | |
tree | 08b9644b3574ba6a0d89f857add312fc28cecba3 /spec | |
parent | 248ece76e51014700733727e553a428e2f85579d (diff) | |
download | gitlab-ce-e45179c9b4d0504def48f00cfe4b97463b090614.tar.gz |
remove useless routing tests. Added symlink creation for project with code
Diffstat (limited to 'spec')
-rw-r--r-- | spec/factories.rb | 7 | ||||
-rw-r--r-- | spec/features/search_spec.rb | 3 | ||||
-rw-r--r-- | spec/requests/api/projects_spec.rb | 2 | ||||
-rw-r--r-- | spec/routing/admin_routing_spec.rb | 10 | ||||
-rw-r--r-- | spec/routing/project_routing_spec.rb | 25 | ||||
-rw-r--r-- | spec/support/login_helpers.rb | 5 | ||||
-rw-r--r-- | spec/support/test_env.rb | 5 |
7 files changed, 14 insertions, 43 deletions
diff --git a/spec/factories.rb b/spec/factories.rb index b596f80fa9e..272623440e1 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -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 diff --git a/spec/features/search_spec.rb b/spec/features/search_spec.rb index 5ce4cae3551..3ca59da493b 100644 --- a/spec/features/search_spec.rb +++ b/spec/features/search_spec.rb @@ -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 diff --git a/spec/requests/api/projects_spec.rb b/spec/requests/api/projects_spec.rb index 31075149647..437722c774c 100644 --- a/spec/requests/api/projects_spec.rb +++ b/spec/requests/api/projects_spec.rb @@ -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) } diff --git a/spec/routing/admin_routing_spec.rb b/spec/routing/admin_routing_spec.rb index 36b546fb077..de5e831c4b4 100644 --- a/spec/routing/admin_routing_spec.rb +++ b/spec/routing/admin_routing_spec.rb @@ -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 diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index b2b20ef6b5d..7f88029de52 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -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 diff --git a/spec/support/login_helpers.rb b/spec/support/login_helpers.rb index d423ccf8a10..46794f48384 100644 --- a/spec/support/login_helpers.rb +++ b/spec/support/login_helpers.rb @@ -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 diff --git a/spec/support/test_env.rb b/spec/support/test_env.rb index efc629e6478..cf80d4901b8 100644 --- a/spec/support/test_env.rb +++ b/spec/support/test_env.rb @@ -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) |