Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sample_app
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tan Phat Nguyen
sample_app
Commits
e97d813a
Commit
e97d813a
authored
Nov 05, 2014
by
Tan Phat Nguyen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add test flash
parent
e3024bdf
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
3 deletions
+8
-3
app/helpers/users_helper.rb
+3
-2
app/views/layouts/application.html.erb
+2
-1
test/integration/users_signup_test.rb
+3
-0
No files found.
app/helpers/users_helper.rb
View file @
e97d813a
module
UsersHelper
module
UsersHelper
# Returns the Gravatar for the given user.
# Returns the Gravatar for the given user.
def
gravatar_for
(
user
)
def
gravatar_for
(
user
,
options
=
{
size:
80
}
)
gravatar_id
=
Digest
::
MD5
::
hexdigest
(
user
.
email
.
downcase
)
gravatar_id
=
Digest
::
MD5
::
hexdigest
(
user
.
email
.
downcase
)
gravatar_url
=
"https://secure.gravatar.com/avatar/
#{
gravatar_id
}
"
size
=
options
[
:size
]
gravatar_url
=
"https://secure.gravatar.com/avatar/
#{
gravatar_id
}
?s=
#{
size
}
"
image_tag
(
gravatar_url
,
alt:
user
.
name
,
class:
"gravatar"
)
image_tag
(
gravatar_url
,
alt:
user
.
name
,
class:
"gravatar"
)
end
end
end
end
app/views/layouts/application.html.erb
View file @
e97d813a
...
@@ -12,7 +12,8 @@
...
@@ -12,7 +12,8 @@
<%=
render
'layouts/header'
%>
<%=
render
'layouts/header'
%>
<div
class=
"container"
>
<div
class=
"container"
>
<%
flash
.
each
do
|
message_type
,
message
|
%>
<%
flash
.
each
do
|
message_type
,
message
|
%>
<div
class=
"alert alert-
<%=
message_type
%>
"
>
<%=
message
%>
</div>
<!-- <div class="alert alert-
<%=
message_type
%>
">
<%=
message
%>
</div> -->
<%=
content_tag
(
:div
,
message
,
class:
"alert alert-
#{
message_type
}
"
)
%>
<%
end
%>
<%
end
%>
<%=
yield
%>
<%=
yield
%>
<%=
render
'layouts/footer'
%>
<%=
render
'layouts/footer'
%>
...
...
test/integration/users_signup_test.rb
View file @
e97d813a
...
@@ -7,6 +7,8 @@ class UsersSignupTest < ActionDispatch::IntegrationTest
...
@@ -7,6 +7,8 @@ class UsersSignupTest < ActionDispatch::IntegrationTest
post
users_path
,
user:
{
name:
""
,
email:
"user@invalid"
,
password:
"foo"
,
password_confirmation:
"bar"
}
post
users_path
,
user:
{
name:
""
,
email:
"user@invalid"
,
password:
"foo"
,
password_confirmation:
"bar"
}
end
end
assert_template
'users/new'
assert_template
'users/new'
assert_select
'div#error_explanation'
assert_select
'div.alert'
end
end
test
"valid signup information"
do
test
"valid signup information"
do
...
@@ -15,5 +17,6 @@ class UsersSignupTest < ActionDispatch::IntegrationTest
...
@@ -15,5 +17,6 @@ class UsersSignupTest < ActionDispatch::IntegrationTest
post_via_redirect
users_path
,
user:
{
name:
"Example User"
,
email:
"user@example.com"
,
password:
"password"
,
password_confirmation:
"password"
}
post_via_redirect
users_path
,
user:
{
name:
"Example User"
,
email:
"user@example.com"
,
password:
"password"
,
password_confirmation:
"password"
}
end
end
assert_template
'users/show'
assert_template
'users/show'
assert_not
flash
.
empty?
end
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