Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
40ba2f7d
Commit
40ba2f7d
authored
Mar 29, 2017
by
Robert Speicher
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Except where necessary, use `sign_in` over `login_as` in features
parent
4ef0c688
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
13 deletions
+70
-13
features/profile/profile.feature
features/profile/profile.feature
+3
-1
features/project/forked_merge_requests.feature
features/project/forked_merge_requests.feature
+1
-2
features/steps/project/forked_merge_requests.rb
features/steps/project/forked_merge_requests.rb
+1
-1
features/steps/project/merge_requests/acceptance.rb
features/steps/project/merge_requests/acceptance.rb
+1
-1
features/steps/project/merge_requests/revert.rb
features/steps/project/merge_requests/revert.rb
+1
-1
features/steps/shared/authentication.rb
features/steps/shared/authentication.rb
+44
-7
features/support/login_helpers.rb
features/support/login_helpers.rb
+19
-0
No files found.
features/profile/profile.feature
View file @
40ba2f7d
...
...
@@ -60,7 +60,9 @@ Feature: Profile
Then
I should see a password error message
Scenario
:
I
visit history tab
Given
I have activity
Given
I logout
And
I sign in via the UI
And
I have activity
When
I visit Audit Log page
Then
I should see my activity
...
...
features/project/forked_merge_requests.feature
View file @
40ba2f7d
...
...
@@ -41,8 +41,7 @@ Feature: Project Forked Merge Requests
@javascript
Scenario
:
I
see the users in the target project for a new merge request
Given
I logout
And
I sign in as an admin
Given
I sign in as an admin
And
I have a project forked off of
"Shop"
called
"Forked Shop"
Then
I visit project
"Forked Shop"
merge requests page
And
I click link
"New Merge Request"
...
...
features/steps/project/forked_merge_requests.rb
View file @
40ba2f7d
...
...
@@ -6,7 +6,7 @@ class Spinach::Features::ProjectForkedMergeRequests < Spinach::FeatureSteps
include
Select2Helper
step
'I am a member of project "Shop"'
do
@project
=
Project
.
find_by
(
name:
"Shop"
)
@project
=
::
Project
.
find_by
(
name:
"Shop"
)
@project
||=
create
(
:project
,
:repository
,
name:
"Shop"
)
@project
.
team
<<
[
@user
,
:reporter
]
end
...
...
features/steps/project/merge_requests/acceptance.rb
View file @
40ba2f7d
...
...
@@ -43,7 +43,7 @@ class Spinach::Features::ProjectMergeRequestsAcceptance < Spinach::FeatureSteps
end
step
'I am signed in as a developer of the project'
do
login_as
(
@user
)
sign_in
(
@user
)
end
step
'I should see merge request merged'
do
...
...
features/steps/project/merge_requests/revert.rb
View file @
40ba2f7d
...
...
@@ -31,7 +31,7 @@ class Spinach::Features::RevertMergeRequests < Spinach::FeatureSteps
step
'I am signed in as a developer of the project'
do
@user
=
create
(
:user
)
{
|
u
|
@project
.
add_developer
(
u
)
}
login_as
(
@user
)
sign_in
(
@user
)
end
step
'There is an open Merge Request'
do
...
...
features/steps/shared/authentication.rb
View file @
40ba2f7d
require
Rails
.
root
.
join
(
'
spec
'
,
'support'
,
'login_helpers'
)
require
Rails
.
root
.
join
(
'
features
'
,
'support'
,
'login_helpers'
)
module
SharedAuthentication
include
Spinach
::
DSL
include
LoginHelpers
step
'I sign in as a user'
do
login_as
:user
sign_out
(
@user
)
if
@user
@user
=
create
(
:user
)
sign_in
(
@user
)
end
step
'I sign in via the UI'
do
gitlab_sign_in
(
create
(
:user
))
end
step
'I sign in as an admin'
do
login_as
:admin
sign_out
(
@user
)
if
@user
@user
=
create
(
:admin
)
sign_in
(
@user
)
end
step
'I sign in as "John Doe"'
do
login_with
(
user_exists
(
"John Doe"
))
gitlab_sign_in
(
user_exists
(
"John Doe"
))
end
step
'I sign in as "Mary Jane"'
do
login_with
(
user_exists
(
"Mary Jane"
))
gitlab_sign_in
(
user_exists
(
"Mary Jane"
))
end
step
'I should be redirected to sign in page'
do
...
...
@@ -25,14 +35,41 @@ module SharedAuthentication
end
step
"I logout"
do
log
out
gitlab_sign_
out
end
step
"I logout directly"
do
logout_direc
t
gitlab_sign_ou
t
end
def
current_user
@user
||
User
.
reorder
(
nil
).
first
end
private
def
gitlab_sign_in
(
user
)
visit
new_user_session_path
fill_in
"user_login"
,
with:
user
.
email
fill_in
"user_password"
,
with:
"12345678"
check
'user_remember_me'
click_button
"Sign in"
@user
=
user
end
def
gitlab_sign_out
return
unless
@user
if
Capybara
.
current_driver
==
Capybara
.
javascript_driver
find
(
'.header-user-dropdown-toggle'
).
click
click_link
'Sign out'
expect
(
page
).
to
have_button
(
'Sign in'
)
else
sign_out
(
@user
)
end
@user
=
nil
end
end
features/support/login_helpers.rb
0 → 100644
View file @
40ba2f7d
module
LoginHelpers
# After inclusion, IntegrationHelpers calls these two methods that aren't
# supported by Spinach, so we perform the end results ourselves
class
<<
self
def
setup
(
*
args
)
Spinach
.
hooks
.
before_scenario
do
Warden
.
test_mode!
end
end
def
teardown
(
*
args
)
Spinach
.
hooks
.
after_scenario
do
Warden
.
test_reset!
end
end
end
include
Devise
::
Test
::
IntegrationHelpers
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment