Commit a2af32fa authored by Robert Speicher's avatar Robert Speicher

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.
parent eae3dedb
...@@ -3,9 +3,8 @@ require 'spec_helper' ...@@ -3,9 +3,8 @@ require 'spec_helper'
describe 'Filter issues', js: true do describe 'Filter issues', js: true do
include FilteredSearchHelpers include FilteredSearchHelpers
let!(:project) { create(:project) } let(:project) { create(:project) }
let!(:user) { create(:user) } let(:user) { create(:user) }
let!(:user2) { create(:user) }
let!(:label) { create(:label, project: project) } let!(:label) { create(:label, project: project) }
let!(:wontfix) { create(:label, project: project, title: "Won't fix") } let!(:wontfix) { create(:label, project: project, title: "Won't fix") }
...@@ -37,56 +36,50 @@ describe 'Filter issues', js: true do ...@@ -37,56 +36,50 @@ describe 'Filter issues', js: true do
end end
before do before do
project.team << [user, :master] project.add_master(user)
project.team << [user2, :master]
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, author: user, title: "issue by assignee", milestone: milestone, assignees: [user])
create(:issue, project: project, title: "Bug report 2") create(:issue, project: project, author: user, title: "issue by assignee with searchTerm", milestone: milestone, assignees: [user])
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])
issue = create(:issue, create(:labeled_issue,
title: "Bug 2", title: "Bug 2",
project: project, project: project,
milestone: milestone, milestone: milestone,
author: user, author: user,
assignees: [user]) assignees: [user],
issue.labels << bug_label labels: [bug_label])
issue_with_caps_label = create(:issue, create(:labeled_issue,
title: "issue by assignee with searchTerm and label", title: "issue by assignee with searchTerm and label",
project: project, project: project,
milestone: milestone, milestone: milestone,
author: user, author: user,
assignees: [user]) assignees: [user],
issue_with_caps_label.labels << caps_sensitive_label labels: [caps_sensitive_label])
issue_with_everything = create(:issue, create(:labeled_issue,
title: "Bug report foo was possible", title: "Bug report foo was possible",
project: project, project: project,
milestone: milestone, milestone: milestone,
author: user, author: user,
assignees: [user]) assignees: [user],
issue_with_everything.labels << bug_label labels: [bug_label, caps_sensitive_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
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, create(:milestone, project: project, due_date: 1.month.from_now) do |future_milestone|
title: "Issue with future milestone", create(:issue, project: project, milestone: future_milestone, author: user2)
milestone: future_milestone, end
project: project)
allow_any_instance_of(ApplicationHelper).to receive(:collapsed_sidebar?).and_return(true)
sign_in(user)
visit project_issues_path(project) visit project_issues_path(project)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment