Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
PropTrackr
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
Package registry
Container 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
kerdo
PropTrackr
Commits
ab0525a4
Commit
ab0525a4
authored
5 months ago
by
Nurdaulet Seilkhanov
Browse files
Options
Downloads
Patches
Plain Diff
Fixed tests for last commit
parent
69474423
No related branches found
No related tags found
1 merge request
!4
Resolve "FR-01: Account registration"
Pipeline
#43063
passed
5 months ago
Stage: build
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
features/contexts/user_registration_context.exs
+2
-2
2 additions, 2 deletions
features/contexts/user_registration_context.exs
test/proptrackr_web/controllers/user_controller_test.exs
+4
-4
4 additions, 4 deletions
test/proptrackr_web/controllers/user_controller_test.exs
with
6 additions
and
6 deletions
features/contexts/user_registration_context.exs
+
2
−
2
View file @
ab0525a4
...
...
@@ -23,7 +23,7 @@ defmodule UserRegistrationContext do
end
given_
~r/^I am on the registration page$/
,
fn
state
->
navigate_to
(
"/
users/new
"
)
navigate_to
(
"/
register
"
)
{
:ok
,
state
}
end
...
...
@@ -37,7 +37,7 @@ defmodule UserRegistrationContext do
"test123"
,
"test123"
)
{
:ok
,
Map
.
put
(
state
,
:name
,
"Test"
)
}
{
:ok
,
state
}
end
and_
~r/^I submit the form$/
,
fn
state
->
...
...
This diff is collapsed.
Click to expand it.
test/proptrackr_web/controllers/user_controller_test.exs
+
4
−
4
View file @
ab0525a4
...
...
@@ -17,7 +17,7 @@ defmodule PropTrackrWeb.UserControllerTest do
end
test
"AC1: unauthenticated user can register an account"
,
%{
conn:
conn
,
user_params:
user_params
}
do
conn
=
post
(
conn
,
"/
us
er
s
"
,
user:
user_params
)
conn
=
post
(
conn
,
"/
regist
er"
,
user:
user_params
)
assert
html_response
(
conn
,
302
)
assert
get_flash
(
conn
,
:info
)
==
"User created successfully."
assert
redirected_to
(
conn
)
==
"/users"
...
...
@@ -25,18 +25,18 @@ defmodule PropTrackrWeb.UserControllerTest do
test
"AC2 and AC3: user sees an error when passwords do not match"
,
%{
conn:
conn
,
user_params:
user_params
}
do
mismatched_params
=
Map
.
put
(
user_params
,
:confirm_password
,
"different_password"
)
conn
=
post
(
conn
,
"/
us
er
s
"
,
user:
mismatched_params
)
conn
=
post
(
conn
,
"/
regist
er"
,
user:
mismatched_params
)
assert
html_response
(
conn
,
200
)
=~
"Passwords do not match."
end
test
"AC4: user sees an error if an account with the same email exists"
,
%{
conn:
conn
,
user_params:
user_params
}
do
Repo
.
insert!
(%
User
{
email:
user_params
[
:email
],
password:
"test123"
})
conn
=
post
(
conn
,
"/
us
er
s
"
,
user:
user_params
)
conn
=
post
(
conn
,
"/
regist
er"
,
user:
user_params
)
assert
html_response
(
conn
,
200
)
=~
"An account with this email already exists"
end
test
"AC5, AC6, AC7: user is logged in, redirected, and shown notification upon successful registration"
,
%{
conn:
conn
,
user_params:
user_params
}
do
conn
=
post
(
conn
,
"/
us
er
s
"
,
user:
user_params
)
conn
=
post
(
conn
,
"/
regist
er"
,
user:
user_params
)
assert
get_flash
(
conn
,
:info
)
==
"User created successfully."
assert
redirected_to
(
conn
)
==
"/users"
assert
get_session
(
conn
,
:user_id
)
...
...
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