summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-11-16 14:15:41 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2016-11-16 14:15:41 +0000
commite38acad435999403135d151684575feda7b61c74 (patch)
treeae1449a8c7ba3dba829363a19f9b8a2d35e109e6
parentf7d30c20731effe2c0a5843d5b032c9191f55e42 (diff)
parent903431e8895ba196edc7ce67d46279d0d06cba1d (diff)
downloadgitlab-ce-e38acad435999403135d151684575feda7b61c74.tar.gz
Merge branch 'move-snippet-discover-spinach-test-to-rspec' into 'master'
Move 'Explore Snippets' Spinach feature to Rspec ## What does this MR do? It moves the `features/snippets/discover.feature` Spinach test to a Rspec feature. ## Are there points in the code the reviewer needs to double check? The original feature was called 'Discover Snippets', but the UI no longer reflects this wording. The new Rspec feature is called 'Explore Snippets' to reflect UI/Controller/View naming in use. ## Why was this MR needed? As part of deprecating the Spinach test suite. ## Screenshots (if relevant) ## Does this MR meet the acceptance criteria? - [-] [Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added - [-] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md) - [-] API support added - Tests - [x] Added for this feature/bug - [ ] All builds are passing - [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html) - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if it does - rebase it please) - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits) ## What are the relevant issue numbers? #23036 See merge request !7349
-rw-r--r--features/snippets/discover.feature13
-rw-r--r--features/steps/snippets/discover.rb21
-rw-r--r--spec/features/snippets/explore_spec.rb16
3 files changed, 16 insertions, 34 deletions
diff --git a/features/snippets/discover.feature b/features/snippets/discover.feature
deleted file mode 100644
index 1a7e132ea25..00000000000
--- a/features/snippets/discover.feature
+++ /dev/null
@@ -1,13 +0,0 @@
-@snippets
-Feature: Snippets Discover
- Background:
- Given I sign in as a user
- And I have public "Personal snippet one" snippet
- And I have private "Personal snippet private" snippet
- And I have internal "Personal snippet internal" snippet
-
- Scenario: I should see snippets
- Given I visit snippets page
- Then I should see "Personal snippet one" in snippets
- And I should see "Personal snippet internal" in snippets
- And I should not see "Personal snippet private" in snippets
diff --git a/features/steps/snippets/discover.rb b/features/steps/snippets/discover.rb
deleted file mode 100644
index 76379d09d02..00000000000
--- a/features/steps/snippets/discover.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-class Spinach::Features::SnippetsDiscover < Spinach::FeatureSteps
- include SharedAuthentication
- include SharedPaths
- include SharedSnippet
-
- step 'I should see "Personal snippet one" in snippets' do
- expect(page).to have_content "Personal snippet one"
- end
-
- step 'I should see "Personal snippet internal" in snippets' do
- expect(page).to have_content "Personal snippet internal"
- end
-
- step 'I should not see "Personal snippet private" in snippets' do
- expect(page).not_to have_content "Personal snippet private"
- end
-
- def snippet
- @snippet ||= PersonalSnippet.find_by!(title: "Personal snippet one")
- end
-end
diff --git a/spec/features/snippets/explore_spec.rb b/spec/features/snippets/explore_spec.rb
new file mode 100644
index 00000000000..10a4597e467
--- /dev/null
+++ b/spec/features/snippets/explore_spec.rb
@@ -0,0 +1,16 @@
+require 'rails_helper'
+
+feature 'Explore Snippets', feature: true do
+ scenario 'User should see snippets that are not private' do
+ public_snippet = create(:personal_snippet, :public)
+ internal_snippet = create(:personal_snippet, :internal)
+ private_snippet = create(:personal_snippet, :private)
+
+ login_as create(:user)
+ visit explore_snippets_path
+
+ expect(page).to have_content(public_snippet.title)
+ expect(page).to have_content(internal_snippet.title)
+ expect(page).not_to have_content(private_snippet.title)
+ end
+end