Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mastodon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Boudes
mastodon
Commits
509b0cfa
Commit
509b0cfa
authored
7 years ago
by
Yamagishi Kazutoshi
Committed by
Eugen Rochko
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add scenarios for log in (#3497)
parent
fda5c699
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
spec/features/log_in_spec.rb
+34
-6
34 additions, 6 deletions
spec/features/log_in_spec.rb
with
34 additions
and
6 deletions
spec/features/log_in_spec.rb
+
34
−
6
View file @
509b0cfa
require
"rails_helper"
feature
"Log in"
do
given
(
:email
)
{
"test@examle.com"
}
given
(
:password
)
{
"password"
}
given
(
:email
)
{
"test@examle.com"
}
given
(
:password
)
{
"password"
}
given
(
:confirmed_at
)
{
Time
.
now
}
background
do
Fabricate
(
:user
,
email:
email
,
password:
password
)
Fabricate
(
:user
,
email:
email
,
password:
password
,
confirmed_at:
confirmed_at
)
visit
new_user_session_path
end
subject
{
page
}
scenario
"A valid email and password user is able to log in"
do
visit
new_user_session_path
fill_in
"user_email"
,
with:
email
fill_in
"user_password"
,
with:
password
click_on
"Log in"
click_on
I18n
.
t
(
'auth.login'
)
is_expected
.
to
have_css
(
"div.app-holder"
)
end
scenario
"A invalid email and password user is not able to log in"
do
fill_in
"user_email"
,
with:
"invalid_email"
fill_in
"user_password"
,
with:
"invalid_password"
click_on
I18n
.
t
(
'auth.login'
)
is_expected
.
to
have_css
(
".flash-message"
,
text:
failure_message
(
"invalid"
))
end
context
do
given
(
:confirmed_at
)
{
nil
}
scenario
"A unconfirmed user is not able to log in"
do
fill_in
"user_email"
,
with:
email
fill_in
"user_password"
,
with:
password
click_on
I18n
.
t
(
'auth.login'
)
is_expected
.
to
have_css
(
".flash-message"
,
text:
failure_message
(
"unconfirmed"
))
end
end
expect
(
page
).
to
have_css
"div.app-holder"
def
failure_message
(
message
)
keys
=
User
.
authentication_keys
.
map
{
|
key
|
User
.
human_attribute_name
(
key
)
}
I18n
.
t
(
"devise.failure.
#{
message
}
"
,
authentication_keys:
keys
.
join
(
"support.array.words_connector"
))
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment