summaryrefslogtreecommitdiff
path: root/spec/controllers
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-07-08 20:25:25 +0200
committerMarin Jankovski <marin@gitlab.com>2014-07-08 20:25:25 +0200
commite87f2380779871a64742acdd9dd0358aac7eafce (patch)
tree46b7286736da0e285bd3bdc85e5247ea723d7c5d /spec/controllers
parent005752e4c6485cf79b0a53583c03b5a69fe19f10 (diff)
downloadgitlab-ce-e87f2380779871a64742acdd9dd0358aac7eafce.tar.gz
Add tests for redirects.
Diffstat (limited to 'spec/controllers')
-rw-r--r--spec/controllers/blob_controller_spec.rb14
-rw-r--r--spec/controllers/tree_controller_spec.rb13
2 files changed, 27 insertions, 0 deletions
diff --git a/spec/controllers/blob_controller_spec.rb b/spec/controllers/blob_controller_spec.rb
index cea6922e1c3..929f6d3b46d 100644
--- a/spec/controllers/blob_controller_spec.rb
+++ b/spec/controllers/blob_controller_spec.rb
@@ -34,4 +34,18 @@ describe Projects::BlobController do
it { should respond_with(:not_found) }
end
end
+
+ describe 'GET show with tree path' do
+ render_views
+
+ before do
+ get :show, project_id: project.to_param, id: id
+ controller.instance_variable_set(:@blob, nil)
+ end
+
+ context 'redirect to tree' do
+ let(:id) { 'master/doc' }
+ it { should redirect_to("/#{project.path_with_namespace}/tree/master/doc") }
+ end
+ end
end
diff --git a/spec/controllers/tree_controller_spec.rb b/spec/controllers/tree_controller_spec.rb
index 479118a3465..b169c2a678f 100644
--- a/spec/controllers/tree_controller_spec.rb
+++ b/spec/controllers/tree_controller_spec.rb
@@ -40,4 +40,17 @@ describe Projects::TreeController do
it { should respond_with(:not_found) }
end
end
+
+ describe 'GET show with blob path' do
+ render_views
+
+ before do
+ get :show, project_id: project.to_param, id: id
+ end
+
+ context 'redirect to blob' do
+ let(:id) { 'master/README.md' }
+ it { should redirect_to("/#{project.path_with_namespace}/blob/master/README.md") }
+ end
+ end
end