Don't show anything for blank profile values.

This commit is contained in:
Prommah 2015-10-28 02:32:45 +00:00
parent cfc9bdc3aa
commit 3f35776ce6
2 changed files with 19 additions and 8 deletions

24
app/views/users/_general.html.erb Normal file → Executable file
View file

@ -4,10 +4,17 @@
<dl>
<dt>Age</dt>
<dd><%= @user.age %></dd>
<dt>Country</dt>
<dd><%= @user.country %></dd>
<dt>Town</dt>
<dd><%= @user.profile.town %></dd>
<% if !@user.country.blank? %>
<dt>Country</dt>
<dd><%= @user.country %></dd>
<% end %>
<% if !@user.profile.town.blank? %>
<dt>Town</dt>
<dd><%= @user.profile.town %></dd>
<% end %>
<dt>SteamID</dt>
<dd>
<p><%= @user.steamid %></p>
@ -15,9 +22,12 @@
<%= link_to "Search for Steam Account" %>
</div>
</dd>
<dt>Stream</dt>
<dd><%= @user.profile.stream.blank? ? "No Stream Provided" : @user.profile.stream %></dd>
</dd>
<% if !@user.profile.stream.blank? %>
<dt>Stream</dt>
<dd><%= @user.profile.stream %></dd>
</dd>
<% end %>
</dl>
<h4>Contact</h4>

3
spec/features/users/stream_spec.rb Normal file → Executable file
View file

@ -7,7 +7,7 @@ feature "User Stream Information" do
feature "stream administration" do
scenario "user updates their stream" do
visit user_path(user)
expect(page).to have_content("No Stream Provided")
expect(page.html).to_not include("<dt>Stream</dt>")
fill_login_form(user, password)
click_button submit(:user, :login)
visit edit_user_path(user)
@ -17,6 +17,7 @@ feature "User Stream Information" do
click_button "Update Profile"
expect(page).to have_content(I18n.t(:users_update))
visit user_path(user)
expect(page.html).to include("<dt>Stream</dt>")
expect(page).to have_content(stream_url)
end
end