diff options
author | Michael Kozono <mkozono@gmail.com> | 2017-05-18 20:30:17 +0300 |
---|---|---|
committer | Michael Kozono <mkozono@gmail.com> | 2017-05-18 20:30:17 +0300 |
commit | 11f82de1efc087ee812764764e31161347e593cb (patch) | |
tree | 8a24f2055553122e21936e557ac2a316e90b779e /spec | |
parent | 52aba709ffbe2f5410334beca6c114739054ab4c (diff) |
Add test that fails without the fix
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/groups_controller_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/controllers/groups_controller_spec.rb b/spec/controllers/groups_controller_spec.rb index 15dae3231ca..0392315b62f 100644 --- a/spec/controllers/groups_controller_spec.rb +++ b/spec/controllers/groups_controller_spec.rb @@ -250,6 +250,19 @@ describe GroupsController do end end + describe 'ensure_canonical_path' do + context 'when the old group path is a substring of the scheme or host' do + let(:redirect_route) { group.redirect_routes.create(path: 'http') } + + it 'does not modify the requested host' do + get :issues, id: redirect_route.path + + expect(response).to redirect_to(issues_group_path(group.to_param)) + expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group)) + end + end + end + def group_moved_message(redirect_route, group) "Group '#{redirect_route.path}' was moved to '#{group.full_path}'. Please update any links and bookmarks that may still have the old path." end |