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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
3525d5df
Commit
3525d5df
authored
Sep 10, 2017
by
Vitaliy @blackst0ne Klachkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace the profile/emails.feature spinach test with an rspec analog
parent
5d952f75
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
74 deletions
+83
-74
changelogs/unreleased/replace_emails-feature.yml
changelogs/unreleased/replace_emails-feature.yml
+5
-0
features/profile/emails.feature
features/profile/emails.feature
+0
-26
features/steps/profile/emails.rb
features/steps/profile/emails.rb
+0
-48
spec/features/profiles/user_manages_emails_spec.rb
spec/features/profiles/user_manages_emails_spec.rb
+78
-0
No files found.
changelogs/unreleased/replace_emails-feature.yml
0 → 100644
View file @
3525d5df
---
title
:
Replace the profile/emails.feature spinach test with an rspec analog
merge_request
:
14172
author
:
Vitaliy @blackst0ne Klachkov
type
:
other
features/profile/emails.feature
deleted
100644 → 0
View file @
5d952f75
@profile
Feature
:
Profile Emails
Background
:
Given
I sign in as a user
And
I visit profile emails page
Scenario
:
I
should see emails
Then
I should see my emails
Scenario
:
Add new email
Given
I submit new email
"my@email.com"
Then
I should see new email
"my@email.com"
And
I should see my emails
Scenario
:
Add duplicate email
Given
I submit duplicate email @user.email
Then
I should not have @user.email added
And
I should see my emails
Scenario
:
Remove email
Given
I submit new email
"my@email.com"
Then
I should see new email
"my@email.com"
And
I should see my emails
Then
I click link
"Remove"
for
"my@email.com"
Then
I should not see email
"my@email.com"
And
I should see my emails
features/steps/profile/emails.rb
deleted
100644 → 0
View file @
5d952f75
class
Spinach::Features::ProfileEmails
<
Spinach
::
FeatureSteps
include
SharedAuthentication
step
'I visit profile emails page'
do
visit
profile_emails_path
end
step
'I should see my emails'
do
expect
(
page
).
to
have_content
(
@user
.
email
)
@user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
end
step
'I submit new email "my@email.com"'
do
fill_in
"email_email"
,
with:
"my@email.com"
click_button
"Add"
end
step
'I should see new email "my@email.com"'
do
email
=
@user
.
emails
.
find_by
(
email:
"my@email.com"
)
expect
(
email
).
not_to
be_nil
expect
(
page
).
to
have_content
(
"my@email.com"
)
end
step
'I should not see email "my@email.com"'
do
email
=
@user
.
emails
.
find_by
(
email:
"my@email.com"
)
expect
(
email
).
to
be_nil
expect
(
page
).
not_to
have_content
(
"my@email.com"
)
end
step
'I click link "Remove" for "my@email.com"'
do
# there should only be one remove button at this time
click_link
"Remove"
# force these to reload as they have been cached
@user
.
emails
.
reload
end
step
'I submit duplicate email @user.email'
do
fill_in
"email_email"
,
with:
@user
.
email
click_button
"Add"
end
step
'I should not have @user.email added'
do
email
=
@user
.
emails
.
find_by
(
email:
@user
.
email
)
expect
(
email
).
to
be_nil
end
end
spec/features/profiles/user_manages_emails_spec.rb
0 → 100644
View file @
3525d5df
require
'spec_helper'
describe
'User manages emails'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
sign_in
(
user
)
visit
(
profile_emails_path
)
end
it
"shows user's emails"
do
expect
(
page
).
to
have_content
(
user
.
email
)
user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
end
it
'adds an email'
do
fill_in
(
'email_email'
,
with:
'my@email.com'
)
click_button
(
'Add'
)
email
=
user
.
emails
.
find_by
(
email:
'my@email.com'
)
expect
(
email
).
not_to
be_nil
expect
(
page
).
to
have_content
(
'my@email.com'
)
expect
(
page
).
to
have_content
(
user
.
email
)
user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
end
it
'does not add a duplicate email'
do
fill_in
(
'email_email'
,
with:
user
.
email
)
click_button
(
'Add'
)
email
=
user
.
emails
.
find_by
(
email:
user
.
email
)
expect
(
email
).
to
be_nil
expect
(
page
).
to
have_content
(
user
.
email
)
user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
end
it
'removes an email'
do
fill_in
(
'email_email'
,
with:
'my@email.com'
)
click_button
(
'Add'
)
email
=
user
.
emails
.
find_by
(
email:
'my@email.com'
)
expect
(
email
).
not_to
be_nil
expect
(
page
).
to
have_content
(
'my@email.com'
)
expect
(
page
).
to
have_content
(
user
.
email
)
user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
# There should be only one remove button at this time
click_link
(
'Remove'
)
# Force these to reload as they have been cached
user
.
emails
.
reload
email
=
user
.
emails
.
find_by
(
email:
'my@email.com'
)
expect
(
email
).
to
be_nil
expect
(
page
).
not_to
have_content
(
'my@email.com'
)
expect
(
page
).
to
have_content
(
user
.
email
)
user
.
emails
.
each
do
|
email
|
expect
(
page
).
to
have_content
(
email
.
email
)
end
end
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