BigW Consortium Gitlab

admin_routing_spec.rb 6.33 KB
Newer Older
Robert Speicher committed
1 2 3 4 5 6 7 8 9 10 11 12 13
require 'spec_helper'

#       block_admin_user PUT    /admin/users/:id/block(.:format)       admin/users#block
#     unblock_admin_user PUT    /admin/users/:id/unblock(.:format)     admin/users#unblock
#            admin_users GET    /admin/users(.:format)                 admin/users#index
#                        POST   /admin/users(.:format)                 admin/users#create
#         new_admin_user GET    /admin/users/new(.:format)             admin/users#new
#        edit_admin_user GET    /admin/users/:id/edit(.:format)        admin/users#edit
#             admin_user GET    /admin/users/:id(.:format)             admin/users#show
#                        PUT    /admin/users/:id(.:format)             admin/users#update
#                        DELETE /admin/users/:id(.:format)             admin/users#destroy
describe Admin::UsersController, "routing" do
  it "to #block" do
14
    expect(put("/admin/users/1/block")).to route_to('admin/users#block', id: '1')
Robert Speicher committed
15 16 17
  end

  it "to #unblock" do
18
    expect(put("/admin/users/1/unblock")).to route_to('admin/users#unblock', id: '1')
Robert Speicher committed
19 20 21
  end

  it "to #index" do
22
    expect(get("/admin/users")).to route_to('admin/users#index')
Robert Speicher committed
23 24 25
  end

  it "to #show" do
26
    expect(get("/admin/users/1")).to route_to('admin/users#show', id: '1')
Robert Speicher committed
27 28 29
  end

  it "to #create" do
30
    expect(post("/admin/users")).to route_to('admin/users#create')
Robert Speicher committed
31 32 33
  end

  it "to #new" do
34
    expect(get("/admin/users/new")).to route_to('admin/users#new')
Robert Speicher committed
35 36 37
  end

  it "to #edit" do
38
    expect(get("/admin/users/1/edit")).to route_to('admin/users#edit', id: '1')
Robert Speicher committed
39 40 41
  end

  it "to #show" do
42
    expect(get("/admin/users/1")).to route_to('admin/users#show', id: '1')
Robert Speicher committed
43 44 45
  end

  it "to #update" do
46
    expect(put("/admin/users/1")).to route_to('admin/users#update', id: '1')
Robert Speicher committed
47 48 49
  end

  it "to #destroy" do
50
    expect(delete("/admin/users/1")).to route_to('admin/users#destroy', id: '1')
Robert Speicher committed
51 52 53
  end
end

54 55 56 57 58 59 60 61 62
#        team_admin_project GET    /admin/projects/:id/team(.:format)        admin/projects#team {id: /[^\/]+/}
# team_update_admin_project PUT    /admin/projects/:id/team_update(.:format) admin/projects#team_update {id: /[^\/]+/}
#            admin_projects GET    /admin/projects(.:format)                 admin/projects#index {id: /[^\/]+/}
#                           POST   /admin/projects(.:format)                 admin/projects#create {id: /[^\/]+/}
#         new_admin_project GET    /admin/projects/new(.:format)             admin/projects#new {id: /[^\/]+/}
#        edit_admin_project GET    /admin/projects/:id/edit(.:format)        admin/projects#edit {id: /[^\/]+/}
#             admin_project GET    /admin/projects/:id(.:format)             admin/projects#show {id: /[^\/]+/}
#                           PUT    /admin/projects/:id(.:format)             admin/projects#update {id: /[^\/]+/}
#                           DELETE /admin/projects/:id(.:format)             admin/projects#destroy {id: /[^\/]+/}
Robert Speicher committed
63 64
describe Admin::ProjectsController, "routing" do
  it "to #index" do
65
    expect(get("/admin/projects")).to route_to('admin/projects#index')
Robert Speicher committed
66 67 68
  end

  it "to #show" do
69 70
    expect(get("/admin/projects/gitlab/gitlab-ce")).to route_to('admin/projects#show', namespace_id: 'gitlab', id: 'gitlab-ce')
    expect(get("/admin/projects/gitlab/subgroup/gitlab-ce")).to route_to('admin/projects#show', namespace_id: 'gitlab/subgroup', id: 'gitlab-ce')
Robert Speicher committed
71 72 73
  end
end

74
# admin_hook_test GET    /admin/hooks/:id/test(.:format)      admin/hooks#test
Robert Speicher committed
75 76 77
#     admin_hooks GET    /admin/hooks(.:format)               admin/hooks#index
#                 POST   /admin/hooks(.:format)               admin/hooks#create
#      admin_hook DELETE /admin/hooks/:id(.:format)           admin/hooks#destroy
78 79
#                 PUT    /admin/hooks/:id(.:format)           admin/hooks#update
# edit_admin_hook GET    /admin/hooks/:id(.:format)           admin/hooks#edit
Robert Speicher committed
80 81
describe Admin::HooksController, "routing" do
  it "to #test" do
82
    expect(get("/admin/hooks/1/test")).to route_to('admin/hooks#test', id: '1')
Robert Speicher committed
83 84 85
  end

  it "to #index" do
86
    expect(get("/admin/hooks")).to route_to('admin/hooks#index')
Robert Speicher committed
87 88 89
  end

  it "to #create" do
90
    expect(post("/admin/hooks")).to route_to('admin/hooks#create')
Robert Speicher committed
91 92
  end

93 94 95 96 97 98 99 100
  it "to #edit" do
    expect(get("/admin/hooks/1/edit")).to route_to('admin/hooks#edit', id: '1')
  end

  it "to #update" do
    expect(put("/admin/hooks/1")).to route_to('admin/hooks#update', id: '1')
  end

Robert Speicher committed
101
  it "to #destroy" do
102
    expect(delete("/admin/hooks/1")).to route_to('admin/hooks#destroy', id: '1')
Robert Speicher committed
103 104 105
  end
end

106 107 108 109 110 111 112 113 114 115 116 117
# admin_hook_hook_log_retry GET    /admin/hooks/:hook_id/hook_logs/:id/retry(.:format) admin/hook_logs#retry
# admin_hook_hook_log       GET    /admin/hooks/:hook_id/hook_logs/:id(.:format)       admin/hook_logs#show
describe Admin::HookLogsController, 'routing' do
  it 'to #retry' do
    expect(get('/admin/hooks/1/hook_logs/1/retry')).to route_to('admin/hook_logs#retry', hook_id: '1', id: '1')
  end

  it 'to #show' do
    expect(get('/admin/hooks/1/hook_logs/1')).to route_to('admin/hook_logs#show', hook_id: '1', id: '1')
  end
end

Robert Speicher committed
118 119 120
# admin_logs GET    /admin/logs(.:format) admin/logs#show
describe Admin::LogsController, "routing" do
  it "to #show" do
121
    expect(get("/admin/logs")).to route_to('admin/logs#show')
Robert Speicher committed
122 123 124
  end
end

125 126
# admin_background_jobs GET    /admin/background_jobs(.:format) admin/background_jobs#show
describe Admin::BackgroundJobsController, "routing" do
Robert Speicher committed
127
  it "to #show" do
128
    expect(get("/admin/background_jobs")).to route_to('admin/background_jobs#show')
Robert Speicher committed
129 130 131 132 133 134
  end
end

# admin_root        /admin(.:format) admin/dashboard#index
describe Admin::DashboardController, "routing" do
  it "to #index" do
135
    expect(get("/admin")).to route_to('admin/dashboard#index')
Robert Speicher committed
136 137
  end
end
138 139 140 141 142 143 144

# admin_health_check GET    /admin/health_check(.:format) admin/health_check#show
describe Admin::HealthCheckController, "routing" do
  it "to #show" do
    expect(get("/admin/health_check")).to route_to('admin/health_check#show')
  end
end
145 146

describe Admin::GroupsController, "routing" do
147 148
  let(:name) { 'complex.group-namegit' }

149 150 151 152 153
  it "to #index" do
    expect(get("/admin/groups")).to route_to('admin/groups#index')
  end

  it "to #show" do
154 155 156 157 158 159
    expect(get("/admin/groups/#{name}")).to route_to('admin/groups#show', id: name)
    expect(get("/admin/groups/#{name}/subgroup")).to route_to('admin/groups#show', id: "#{name}/subgroup")
  end

  it "to #edit" do
    expect(get("/admin/groups/#{name}/edit")).to route_to('admin/groups#edit', id: name)
160 161
  end
end