diff options
author | Robert Speicher <rspeicher@gmail.com> | 2017-08-31 15:19:26 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2017-09-01 10:46:05 -0400 |
commit | a2af32fa88d4b9aae6e0a9f4a0491bffe44e0190 (patch) | |
tree | e408ae4f2deb7e7b2f82d5adce22ab4a6ed8a9b0 | |
parent | eae3dedbc9d02354c8a26740d81cce29a7867fab (diff) | |
download | gitlab-ce-a2af32fa88d4b9aae6e0a9f4a0491bffe44e0190.tar.gz |
Clean up the still-way-too-complex filter_issues_spec setup
Removes unnecessary `let!` usage since we explicitly access these in the
`before.
Re-uses `user2` as the author for issues we otherwise don't care about
the author for, to avoid creating a new user in each one.
Makes use of the `labeled_issue` factory to avoid assigning variables
just so we can add labels to an issue.
-rw-r--r-- | spec/features/issues/filtered_search/filter_issues_spec.rb | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/spec/features/issues/filtered_search/filter_issues_spec.rb b/spec/features/issues/filtered_search/filter_issues_spec.rb index 6a01434c23d..627537357b8 100644 --- a/spec/features/issues/filtered_search/filter_issues_spec.rb +++ b/spec/features/issues/filtered_search/filter_issues_spec.rb @@ -3,9 +3,8 @@ require 'spec_helper' describe 'Filter issues', js: true do include FilteredSearchHelpers - let!(:project) { create(:project) } - let!(:user) { create(:user) } - let!(:user2) { create(:user) } + let(:project) { create(:project) } + let(:user) { create(:user) } let!(:label) { create(:label, project: project) } let!(:wontfix) { create(:label, project: project, title: "Won't fix") } @@ -37,56 +36,50 @@ describe 'Filter issues', js: true do end before do - project.team << [user, :master] - project.team << [user2, :master] + project.add_master(user) - sign_in(user) + user2 = create(:user) + + create(:issue, project: project, author: user2, title: "Bug report 1") + create(:issue, project: project, author: user2, title: "Bug report 2") + create(:issue, project: project, author: user2, title: "issue with 'single quotes'") + create(:issue, project: project, author: user2, title: "issue with \"double quotes\"") + create(:issue, project: project, author: user2, title: "issue with !@\#{$%^&*()-+") - create(:issue, project: project, title: "Bug report 1") - create(:issue, project: project, title: "Bug report 2") - create(:issue, project: project, title: "issue with 'single quotes'") - create(:issue, project: project, title: "issue with \"double quotes\"") - create(:issue, project: project, title: "issue with !@\#{$%^&*()-+") - create(:issue, project: project, title: "issue by assignee", milestone: milestone, author: user, assignees: [user]) - create(:issue, project: project, title: "issue by assignee with searchTerm", milestone: milestone, author: user, assignees: [user]) + create(:issue, project: project, author: user, title: "issue by assignee", milestone: milestone, assignees: [user]) + create(:issue, project: project, author: user, title: "issue by assignee with searchTerm", milestone: milestone, assignees: [user]) - issue = create(:issue, + create(:labeled_issue, title: "Bug 2", project: project, milestone: milestone, author: user, - assignees: [user]) - issue.labels << bug_label + assignees: [user], + labels: [bug_label]) - issue_with_caps_label = create(:issue, + create(:labeled_issue, title: "issue by assignee with searchTerm and label", project: project, milestone: milestone, author: user, - assignees: [user]) - issue_with_caps_label.labels << caps_sensitive_label + assignees: [user], + labels: [caps_sensitive_label]) - issue_with_everything = create(:issue, + create(:labeled_issue, title: "Bug report foo was possible", project: project, milestone: milestone, author: user, - assignees: [user]) - issue_with_everything.labels << bug_label - issue_with_everything.labels << caps_sensitive_label - - multiple_words_label_issue = create(:issue, title: "Issue with multiple words label", project: project) - multiple_words_label_issue.labels << multiple_words_label + assignees: [user], + labels: [bug_label, caps_sensitive_label]) - future_milestone = create(:milestone, project: project, due_date: 1.month.from_now) + create(:labeled_issue, title: "Issue with multiple words label", project: project, labels: [multiple_words_label]) - create(:issue, - title: "Issue with future milestone", - milestone: future_milestone, - project: project) - - allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true) + create(:milestone, project: project, due_date: 1.month.from_now) do |future_milestone| + create(:issue, project: project, milestone: future_milestone, author: user2) + end + sign_in(user) visit project_issues_path(project) end |