Commit 3d61609c authored by Robert Speicher's avatar Robert Speicher

Use `sign_in` instead of `login_as` when we're not testing login flow

This is a proof of concept for gitlab-org/gitlab-ce#30196.

The actual login procedure is well-tested by
`spec/features/login_spec.rb`, and we don't gain anything by also
thoroughly testing it here, in our second-slowest feature spec. In fact,
it only slows us down!

So instead we use `sign_in` from the `Devise::Test::IntegrationHelpers`
module, which just sets the current user at the Warden level. This
drastically reduces the "setup" phase of every test in this file. A
non-scientific test run saw this drop from 633 to 231 seconds.
parent 93de37ce
require 'spec_helper'
describe 'Filter issues', js: true, feature: true do
include Devise::Test::IntegrationHelpers
include FilteredSearchHelpers
include WaitForAjax
......@@ -42,16 +43,17 @@ describe 'Filter issues', js: true, feature: true do
project.team << [user2, :master]
group.add_developer(user)
group.add_developer(user2)
login_as(user)
create(:issue, project: project)
create(:issue, title: "Bug report 1", project: project)
create(:issue, title: "Bug report 2", project: project)
create(:issue, title: "issue with 'single quotes'", project: project)
create(:issue, title: "issue with \"double quotes\"", project: project)
create(:issue, title: "issue with !@\#{$%^&*()-+", project: project)
create(:issue, title: "issue by assignee", project: project, milestone: milestone, author: user, assignee: user)
create(:issue, title: "issue by assignee with searchTerm", project: project, milestone: milestone, author: user, assignee: user)
sign_in(user)
create(:issue, project: project)
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, assignee: user)
create(:issue, project: project, title: "issue by assignee with searchTerm", milestone: milestone, author: user, assignee: user)
issue = create(:issue,
title: "Bug 2",
......
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