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
7e44be2e
Commit
7e44be2e
authored
4 months ago
by
Kerdo Kurs
Browse files
Options
Downloads
Patches
Plain Diff
HOTFIX: fix TDD test
parent
4d3515f6
No related branches found
No related tags found
No related merge requests found
Pipeline
#45345
passed
4 months ago
Stage: build
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/proptrackr_web/controllers/properties_controller.ex
+13
-13
13 additions, 13 deletions
lib/proptrackr_web/controllers/properties_controller.ex
test/proptrackr_web/controllers/my_advertisements_controller_test.exs
+3
-1
3 additions, 1 deletion
...ckr_web/controllers/my_advertisements_controller_test.exs
with
16 additions
and
14 deletions
lib/proptrackr_web/controllers/properties_controller.ex
+
13
−
13
View file @
7e44be2e
...
...
@@ -38,25 +38,25 @@ defmodule PropTrackrWeb.PropertiesController do
select:
p
)
current_user
=
conn
.
assigns
.
current_user
can_edit
=
current_user
&&
current_user
.
id
==
property
.
user_id
favorites
=
case
current_user
do
nil
->
[]
user
->
Repo
.
all
(
from
f
in
Favorite
,
where:
f
.
user_id
==
^
user
.
id
,
select:
f
.
property_id
)
end
case
property
do
nil
->
conn
|>
put_flash
(
:error
,
"Property not found."
)
|>
redirect
(
to:
~p"/"
)
property
->
current_user
=
conn
.
assigns
.
current_user
can_edit
=
current_user
&&
current_user
.
id
==
property
.
user_id
favorites
=
case
current_user
do
nil
->
[]
user
->
Repo
.
all
(
from
f
in
Favorite
,
where:
f
.
user_id
==
^
user
.
id
,
select:
f
.
property_id
)
end
render
(
conn
,
"show.html"
,
property:
property
,
can_edit:
can_edit
,
...
...
This diff is collapsed.
Click to expand it.
test/proptrackr_web/controllers/my_advertisements_controller_test.exs
+
3
−
1
View file @
7e44be2e
...
...
@@ -140,7 +140,9 @@ defmodule PropTrackrWeb.MyPropertiesControllerTest do
# Try to access non-existent property
conn
=
get
(
conn
,
"/properties/non-existent-reference"
)
assert
html_response
(
conn
,
500
)
=~
"Not found"
assert
redirected_to
(
conn
)
==
"/"
conn
=
get
conn
,
redirected_to
(
conn
)
assert
get_flash
(
conn
,
:error
)
==
"Property not found."
end
defp
setup_session
(
conn
,
user
)
do
...
...
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