summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-07-11 17:12:03 +0200
committerMarin Jankovski <marin@gitlab.com>2014-07-11 19:53:10 +0200
commit3b80d68f9d9d074ca24ca7cbc2f123360670a29a (patch)
tree1beb202aff0a939c7f7feb4dc46ecc6e676fcabd
parent07b9d80604f130c5958e24651e73e889c6e43bb7 (diff)
downloadgitlab-ce-3b80d68f9d9d074ca24ca7cbc2f123360670a29a.tar.gz
Add in the tests.
-rw-r--r--features/project/redirects.feature12
-rw-r--r--features/steps/project/redirects.rb37
2 files changed, 48 insertions, 1 deletions
diff --git a/features/project/redirects.feature b/features/project/redirects.feature
index ce197912f64..a2e77e7bf30 100644
--- a/features/project/redirects.feature
+++ b/features/project/redirects.feature
@@ -24,3 +24,15 @@ Feature: Project Redirects
Given I sign in as a user
When I visit project "Enterprise" page
Then page status code should be 404
+
+ Scenario: I visit a public project without signing in
+ When I visit project "Community" page
+ And I should see project "Community" home page
+ And I click on "Sign In"
+ And Authenticate
+ Then I should be redirected to "Community" page
+
+ Scenario: I visit private project page without signing in
+ When I visit project "Enterprise" page
+ And I get redirected to signin page where I sign in
+ Then I should be redirected to "Enterprise" page
diff --git a/features/steps/project/redirects.rb b/features/steps/project/redirects.rb
index cfa4ce82be3..25d37fd7888 100644
--- a/features/steps/project/redirects.rb
+++ b/features/steps/project/redirects.rb
@@ -31,5 +31,40 @@ class Spinach::Features::ProjectRedirects < Spinach::FeatureSteps
project = Project.find_by(name: 'Community')
visit project_path(project) + 'DoesNotExist'
end
-end
+ step 'I click on "Sign In"' do
+ within '.pull-right' do
+ click_link "Sign in"
+ end
+ end
+
+ step 'Authenticate' do
+ admin = create(:admin)
+ project = Project.find_by(name: 'Community')
+ fill_in "user_login", with: admin.email
+ fill_in "user_password", with: admin.password
+ click_button "Sign in"
+ Thread.current[:current_user] = admin
+ end
+
+ step 'I should be redirected to "Community" page' do
+ project = Project.find_by(name: 'Community')
+ page.current_path.should == "/#{project.path_with_namespace}"
+ page.status_code.should == 200
+ end
+
+ step 'I get redirected to signin page where I sign in' do
+ admin = create(:admin)
+ project = Project.find_by(name: 'Enterprise')
+ fill_in "user_login", with: admin.email
+ fill_in "user_password", with: admin.password
+ click_button "Sign in"
+ Thread.current[:current_user] = admin
+ end
+
+ step 'I should be redirected to "Enterprise" page' do
+ project = Project.find_by(name: 'Enterprise')
+ page.current_path.should == "/#{project.path_with_namespace}"
+ page.status_code.should == 200
+ end
+end