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:
authorblackst0ne <blackst0ne.ru@gmail.com>2018-04-03 13:27:56 +0300
committerRémy Coutable <remy@rymai.me>2018-04-03 13:27:56 +0300
commitdc4ae317ea858952acd5c91dd8034832638b3794 (patch)
tree4f62604b27b0ec1ed9f35a509380372e0bdcb638 /spec/features/user_sorts_things_spec.rb
parent95b3bf26cae3c2e483df4591ec5fe492ab9746a5 (diff)
Replace the `project/issues/issues.feature` spinach test with an rspec analog
Diffstat (limited to 'spec/features/user_sorts_things_spec.rb')
-rw-r--r--spec/features/user_sorts_things_spec.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/features/user_sorts_things_spec.rb b/spec/features/user_sorts_things_spec.rb
new file mode 100644
index 00000000000..69ebdddaeec
--- /dev/null
+++ b/spec/features/user_sorts_things_spec.rb
@@ -0,0 +1,57 @@
+require "spec_helper"
+
+# The main goal of this spec is not to check whether the sorting UI works, but
+# to check if the sorting option set by user is being kept persisted while going through pages.
+# The `it`s are named here by convention `starting point -> some pages -> final point`.
+# All those specs are moved out to this spec intentionally to keep them all in one place.
+describe "User sorts things" do
+ include Spec::Support::Helpers::Features::SortingHelpers
+ include Helpers::DashboardHelper
+
+ set(:project) { create(:project_empty_repo, :public) }
+ set(:current_user) { create(:user) } # Using `current_user` instead of just `user` because of the hardoced call in `assigned_mrs_dashboard_path` which is used below.
+ set(:issue) { create(:issue, project: project, author: current_user) }
+ set(:merge_request) { create(:merge_request, target_project: project, source_project: project, author: current_user) }
+
+ before do
+ project.add_developer(current_user)
+ sign_in(current_user)
+ end
+
+ it "issues -> project home page -> issues" do
+ sort_option = "Last updated"
+
+ visit(project_issues_path(project))
+
+ sort_by(sort_option)
+
+ visit(project_path(project))
+ visit(project_issues_path(project))
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+
+ it "issues -> merge requests" do
+ sort_option = "Last updated"
+
+ visit(project_issues_path(project))
+
+ sort_by(sort_option)
+
+ visit(project_merge_requests_path(project))
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+
+ it "merge requests -> dashboard merge requests" do
+ sort_option = "Last updated"
+
+ visit(project_merge_requests_path(project))
+
+ sort_by(sort_option)
+
+ visit(assigned_mrs_dashboard_path)
+
+ expect(find(".issues-filters")).to have_content(sort_option)
+ end
+end