diff options
Diffstat (limited to 'spec/routing/routing_spec.rb')
-rw-r--r-- | spec/routing/routing_spec.rb | 148 |
1 files changed, 74 insertions, 74 deletions
diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index a170bb14144..2e427eac600 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -1,4 +1,4 @@ -require 'spec_helper' +require "spec_helper" # user GET /u/:username/ # user_groups GET /u/:username/groups(.:format) @@ -11,46 +11,46 @@ describe UsersController, "routing" do it "to #show" do allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true) - expect(get("/User")).to route_to('users#show', username: 'User') + expect(get("/User")).to route_to("users#show", username: "User") end it "to #groups" do - expect(get("/users/User/groups")).to route_to('users#groups', username: 'User') + expect(get("/users/User/groups")).to route_to("users#groups", username: "User") end it "to #projects" do - expect(get("/users/User/projects")).to route_to('users#projects', username: 'User') + expect(get("/users/User/projects")).to route_to("users#projects", username: "User") end it "to #contributed" do - expect(get("/users/User/contributed")).to route_to('users#contributed', username: 'User') + expect(get("/users/User/contributed")).to route_to("users#contributed", username: "User") end it "to #snippets" do - expect(get("/users/User/snippets")).to route_to('users#snippets', username: 'User') + expect(get("/users/User/snippets")).to route_to("users#snippets", username: "User") end it "to #calendar" do - expect(get("/users/User/calendar")).to route_to('users#calendar', username: 'User') + expect(get("/users/User/calendar")).to route_to("users#calendar", username: "User") end it "to #calendar_activities" do - expect(get("/users/User/calendar_activities")).to route_to('users#calendar_activities', username: 'User') + expect(get("/users/User/calendar_activities")).to route_to("users#calendar_activities", username: "User") end - describe 'redirect alias routes' do + describe "redirect alias routes" do include RSpec::Rails::RequestExampleGroup - it '/u/user1 redirects to /user1' do - expect(get("/u/user1")).to redirect_to('/user1') + it "/u/user1 redirects to /user1" do + expect(get("/u/user1")).to redirect_to("/user1") end - it '/u/user1/groups redirects to /user1/groups' do - expect(get("/u/user1/groups")).to redirect_to('/users/user1/groups') + it "/u/user1/groups redirects to /user1/groups" do + expect(get("/u/user1/groups")).to redirect_to("/users/user1/groups") end - it '/u/user1/projects redirects to /user1/projects' do - expect(get("/u/user1/projects")).to redirect_to('/users/user1/projects') + it "/u/user1/projects redirects to /user1/projects" do + expect(get("/u/user1/projects")).to redirect_to("/users/user1/projects") end end end @@ -58,7 +58,7 @@ end # search GET /search(.:format) search#show describe SearchController, "routing" do it "to #show" do - expect(get("/search")).to route_to('search#show') + expect(get("/search")).to route_to("search#show") end end @@ -83,35 +83,35 @@ end # DELETE /snippets/:id(.:format) snippets#destroy describe SnippetsController, "routing" do it "to #raw" do - expect(get("/snippets/1/raw")).to route_to('snippets#raw', id: '1') + expect(get("/snippets/1/raw")).to route_to("snippets#raw", id: "1") end it "to #index" do - expect(get("/snippets")).to route_to('snippets#index') + expect(get("/snippets")).to route_to("snippets#index") end it "to #create" do - expect(post("/snippets")).to route_to('snippets#create') + expect(post("/snippets")).to route_to("snippets#create") end it "to #new" do - expect(get("/snippets/new")).to route_to('snippets#new') + expect(get("/snippets/new")).to route_to("snippets#new") end it "to #edit" do - expect(get("/snippets/1/edit")).to route_to('snippets#edit', id: '1') + expect(get("/snippets/1/edit")).to route_to("snippets#edit", id: "1") end it "to #show" do - expect(get("/snippets/1")).to route_to('snippets#show', id: '1') + expect(get("/snippets/1")).to route_to("snippets#show", id: "1") end it "to #update" do - expect(put("/snippets/1")).to route_to('snippets#update', id: '1') + expect(put("/snippets/1")).to route_to("snippets#update", id: "1") end it "to #destroy" do - expect(delete("/snippets/1")).to route_to('snippets#destroy', id: '1') + expect(delete("/snippets/1")).to route_to("snippets#destroy", id: "1") end end @@ -121,22 +121,22 @@ end # help_ui GET /help/ui(.:format) help#ui describe HelpController, "routing" do it "to #index" do - expect(get("/help")).to route_to('help#index') + expect(get("/help")).to route_to("help#index") end - it 'to #show' do - path = '/help/user/markdown.md' - expect(get(path)).to route_to('help#show', - path: 'user/markdown', - format: 'md') + it "to #show" do + path = "/help/user/markdown.md" + expect(get(path)).to route_to("help#show", + path: "user/markdown", + format: "md") - path = '/help/workflow/protected_branches/protected_branches1.png' - expect(get(path)).to route_to('help#show', - path: 'workflow/protected_branches/protected_branches1', - format: 'png') + path = "/help/workflow/protected_branches/protected_branches1.png" + expect(get(path)).to route_to("help#show", + path: "workflow/protected_branches/protected_branches1", + format: "png") - path = '/help/ui' - expect(get(path)).to route_to('help#ui') + path = "/help/ui" + expect(get(path)).to route_to("help#ui") end end @@ -148,33 +148,33 @@ end # profile_update PUT /profile/update(.:format) profile#update describe ProfilesController, "routing" do it "to #account" do - expect(get("/profile/account")).to route_to('profiles/accounts#show') + expect(get("/profile/account")).to route_to("profiles/accounts#show") end it "to #audit_log" do - expect(get("/profile/audit_log")).to route_to('profiles#audit_log') + expect(get("/profile/audit_log")).to route_to("profiles#audit_log") end it "to #reset_feed_token" do - expect(put("/profile/reset_feed_token")).to route_to('profiles#reset_feed_token') + expect(put("/profile/reset_feed_token")).to route_to("profiles#reset_feed_token") end it "to #show" do - expect(get("/profile")).to route_to('profiles#show') + expect(get("/profile")).to route_to("profiles#show") end end # profile_preferences GET /profile/preferences(.:format) profiles/preferences#show # PATCH /profile/preferences(.:format) profiles/preferences#update # PUT /profile/preferences(.:format) profiles/preferences#update -describe Profiles::PreferencesController, 'routing' do - it 'to #show' do - expect(get('/profile/preferences')).to route_to('profiles/preferences#show') +describe Profiles::PreferencesController, "routing" do + it "to #show" do + expect(get("/profile/preferences")).to route_to("profiles/preferences#show") end - it 'to #update' do - expect(put('/profile/preferences')).to route_to('profiles/preferences#update') - expect(patch('/profile/preferences')).to route_to('profiles/preferences#update') + it "to #update" do + expect(put("/profile/preferences")).to route_to("profiles/preferences#update") + expect(patch("/profile/preferences")).to route_to("profiles/preferences#update") end end @@ -186,26 +186,26 @@ end # DELETE /keys/:id(.:format) keys#destroy describe Profiles::KeysController, "routing" do it "to #index" do - expect(get("/profile/keys")).to route_to('profiles/keys#index') + expect(get("/profile/keys")).to route_to("profiles/keys#index") end it "to #create" do - expect(post("/profile/keys")).to route_to('profiles/keys#create') + expect(post("/profile/keys")).to route_to("profiles/keys#create") end it "to #show" do - expect(get("/profile/keys/1")).to route_to('profiles/keys#show', id: '1') + expect(get("/profile/keys/1")).to route_to("profiles/keys#show", id: "1") end it "to #destroy" do - expect(delete("/profile/keys/1")).to route_to('profiles/keys#destroy', id: '1') + expect(delete("/profile/keys/1")).to route_to("profiles/keys#destroy", id: "1") end # get all the ssh-keys of a user it "to #get_keys" do allow_any_instance_of(::Constraints::UserUrlConstrainer).to receive(:matches?).and_return(true) - expect(get("/foo.keys")).to route_to('profiles/keys#get_keys', username: 'foo') + expect(get("/foo.keys")).to route_to("profiles/keys#get_keys", username: "foo") end end @@ -214,22 +214,22 @@ end # DELETE /keys/:id(.:format) keys#destroy describe Profiles::EmailsController, "routing" do it "to #index" do - expect(get("/profile/emails")).to route_to('profiles/emails#index') + expect(get("/profile/emails")).to route_to("profiles/emails#index") end it "to #create" do - expect(post("/profile/emails")).to route_to('profiles/emails#create') + expect(post("/profile/emails")).to route_to("profiles/emails#create") end it "to #destroy" do - expect(delete("/profile/emails/1")).to route_to('profiles/emails#destroy', id: '1') + expect(delete("/profile/emails/1")).to route_to("profiles/emails#destroy", id: "1") end end # profile_avatar DELETE /profile/avatar(.:format) profiles/avatars#destroy describe Profiles::AvatarsController, "routing" do it "to #destroy" do - expect(delete("/profile/avatar")).to route_to('profiles/avatars#destroy') + expect(delete("/profile/avatar")).to route_to("profiles/avatars#destroy") end end @@ -238,67 +238,67 @@ end # dashboard_merge_requests GET /dashboard/merge_requests(.:format) dashboard#merge_requests describe DashboardController, "routing" do it "to #index" do - expect(get("/dashboard")).to route_to('dashboard/projects#index') + expect(get("/dashboard")).to route_to("dashboard/projects#index") end it "to #issues" do - expect(get("/dashboard/issues.html")).to route_to('dashboard#issues', format: 'html') + expect(get("/dashboard/issues.html")).to route_to("dashboard#issues", format: "html") end it "to #calendar_issues" do - expect(get("/dashboard/issues.ics")).to route_to('dashboard#issues_calendar', format: 'ics') + expect(get("/dashboard/issues.ics")).to route_to("dashboard#issues_calendar", format: "ics") end it "to #merge_requests" do - expect(get("/dashboard/merge_requests")).to route_to('dashboard#merge_requests') + expect(get("/dashboard/merge_requests")).to route_to("dashboard#merge_requests") end end # root / root#show -describe RootController, 'routing' do - it 'to #index' do - expect(get('/')).to route_to('root#index') +describe RootController, "routing" do + it "to #index" do + expect(get("/")).to route_to("root#index") end end describe "Authentication", "routing" do it "GET /users/sign_in" do - expect(get("/users/sign_in")).to route_to('sessions#new') + expect(get("/users/sign_in")).to route_to("sessions#new") end it "POST /users/sign_in" do - expect(post("/users/sign_in")).to route_to('sessions#create') + expect(post("/users/sign_in")).to route_to("sessions#create") end # sign_out with GET instead of DELETE facilitates ad-hoc single-sign-out processes # (https://gitlab.com/gitlab-org/gitlab-ce/issues/39708) it "GET /users/sign_out" do - expect(get("/users/sign_out")).to route_to('sessions#destroy') + expect(get("/users/sign_out")).to route_to("sessions#destroy") end it "POST /users/password" do - expect(post("/users/password")).to route_to('passwords#create') + expect(post("/users/password")).to route_to("passwords#create") end it "GET /users/password/new" do - expect(get("/users/password/new")).to route_to('passwords#new') + expect(get("/users/password/new")).to route_to("passwords#new") end it "GET /users/password/edit" do - expect(get("/users/password/edit")).to route_to('passwords#edit') + expect(get("/users/password/edit")).to route_to("passwords#edit") end it "PUT /users/password" do - expect(put("/users/password")).to route_to('passwords#update') + expect(put("/users/password")).to route_to("passwords#update") end end -describe HealthCheckController, 'routing' do - it 'to #index' do - expect(get('/health_check')).to route_to('health_check#index') +describe HealthCheckController, "routing" do + it "to #index" do + expect(get("/health_check")).to route_to("health_check#index") end - it 'also supports passing checks in the url' do - expect(get('/health_check/email')).to route_to('health_check#index', checks: 'email') + it "also supports passing checks in the url" do + expect(get("/health_check/email")).to route_to("health_check#index", checks: "email") end end |