Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-06-20 13:38:33 +0300
committerDouwe Maan <douwe@gitlab.com>2015-06-20 13:38:33 +0300
commitb2eef41d41d603bf9d5340f26bbe640363f608e6 (patch)
tree8cf126e3170fce041133d76b152eeaccd0cd2256 /features
parentcbb1353b288a8c22e3e93dcdb011c27b11c6dd16 (diff)
parente785b9d2e24ca7e16e8ff3fa46f2e2b82478be9b (diff)
Merge branch 'fix-error-500-internal-snippet' into 'master'
Fix Error 500 when one user attempts to access another's personal, internal snippet ### What does this MR do? This MR fixes an Error 500 that occurred if one user tried to access another's personal, internal snippet. Steps to reproduce: ### Why was this MR needed? 1. Go to `<hostname>/snippets/new`. 2. Select "Internal". 3. Create a snippet. Save the URL (e.g. `<hostname>/snippets/20`) 4. Logout and sign in as another user. 5. Go to the URL in step 3. ### What are the relevant issue numbers? Closes #1815 See merge request !854
Diffstat (limited to 'features')
-rw-r--r--features/snippets/snippets.feature13
-rw-r--r--features/steps/shared/authentication.rb4
-rw-r--r--features/steps/snippets/snippets.rb20
3 files changed, 36 insertions, 1 deletions
diff --git a/features/snippets/snippets.feature b/features/snippets/snippets.feature
index 6e8019c326f..4f617b6bed8 100644
--- a/features/snippets/snippets.feature
+++ b/features/snippets/snippets.feature
@@ -25,4 +25,15 @@ Feature: Snippets
Scenario: I destroy "Personal snippet one"
Given I visit snippet page "Personal snippet one"
And I click link "Destroy"
- Then I should not see "Personal snippet one" in snippets \ No newline at end of file
+ Then I should not see "Personal snippet one" in snippets
+
+ Scenario: I create new internal snippet
+ Given I logout directly
+ And I sign in as an admin
+ Then I visit new snippet page
+ And I submit new internal snippet
+ Then I visit snippet page "Internal personal snippet one"
+ And I logout directly
+ Then I sign in as a user
+ Given I visit new snippet page
+ Then I visit snippet page "Internal personal snippet one"
diff --git a/features/steps/shared/authentication.rb b/features/steps/shared/authentication.rb
index 3c0f2a9406a..735e0ef6108 100644
--- a/features/steps/shared/authentication.rb
+++ b/features/steps/shared/authentication.rb
@@ -28,6 +28,10 @@ module SharedAuthentication
logout
end
+ step "I logout directly" do
+ logout_direct
+ end
+
def current_user
@user || User.first
end
diff --git a/features/steps/snippets/snippets.rb b/features/steps/snippets/snippets.rb
index 09fdd1b5a13..426da2918ea 100644
--- a/features/steps/snippets/snippets.rb
+++ b/features/steps/snippets/snippets.rb
@@ -31,6 +31,18 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
click_button "Create snippet"
end
+ step 'I submit new internal snippet' do
+ fill_in "personal_snippet_title", :with => "Internal personal snippet one"
+ fill_in "personal_snippet_file_name", :with => "my_snippet.rb"
+ choose 'personal_snippet_visibility_level_10'
+
+ page.within('.file-editor') do
+ find(:xpath, "//input[@id='personal_snippet_content']").set 'Content of internal snippet'
+ end
+
+ click_button "Create snippet"
+ end
+
step 'I should see snippet "Personal snippet three"' do
expect(page).to have_content "Personal snippet three"
expect(page).to have_content "Content of snippet three"
@@ -58,7 +70,15 @@ class Spinach::Features::Snippets < Spinach::FeatureSteps
visit snippet_path(snippet)
end
+ step 'I visit snippet page "Internal personal snippet one"' do
+ visit snippet_path(internal_snippet)
+ end
+
def snippet
@snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
end
+
+ def internal_snippet
+ @snippet ||= PersonalSnippet.find_by!(title: "Internal personal snippet one")
+ end
end