Commit e97d813a by Tan Phat Nguyen

add test flash

parent e3024bdf
module UsersHelper
# 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_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")
end
end
......@@ -12,7 +12,8 @@
<%= render 'layouts/header' %>
<div class="container">
<% 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 %>
<%= yield %>
<%= render 'layouts/footer' %>
......
......@@ -7,6 +7,8 @@ class UsersSignupTest < ActionDispatch::IntegrationTest
post users_path, user: {name: "", email: "user@invalid", password: "foo", password_confirmation: "bar"}
end
assert_template 'users/new'
assert_select 'div#error_explanation'
assert_select 'div.alert'
end
test "valid signup information" do
......@@ -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"}
end
assert_template 'users/show'
assert_not flash.empty?
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment