From 3f35776ce69293d495fe94fb192c783ec96885ab Mon Sep 17 00:00:00 2001 From: Prommah Date: Wed, 28 Oct 2015 02:32:45 +0000 Subject: [PATCH] Don't show anything for blank profile values. --- app/views/users/_general.html.erb | 24 +++++++++++++++++------- spec/features/users/stream_spec.rb | 3 ++- 2 files changed, 19 insertions(+), 8 deletions(-) mode change 100644 => 100755 app/views/users/_general.html.erb mode change 100644 => 100755 spec/features/users/stream_spec.rb diff --git a/app/views/users/_general.html.erb b/app/views/users/_general.html.erb old mode 100644 new mode 100755 index 793668e..c4507cb --- a/app/views/users/_general.html.erb +++ b/app/views/users/_general.html.erb @@ -4,10 +4,17 @@
Age
<%= @user.age %>
-
Country
-
<%= @user.country %>
-
Town
-
<%= @user.profile.town %>
+ + <% if !@user.country.blank? %> +
Country
+
<%= @user.country %>
+ <% end %> + + <% if !@user.profile.town.blank? %> +
Town
+
<%= @user.profile.town %>
+ <% end %> +
SteamID

<%= @user.steamid %>

@@ -15,9 +22,12 @@ <%= link_to "Search for Steam Account" %>
-
Stream
-
<%= @user.profile.stream.blank? ? "No Stream Provided" : @user.profile.stream %>
- + + <% if !@user.profile.stream.blank? %> +
Stream
+
<%= @user.profile.stream %>
+ + <% end %>

Contact

diff --git a/spec/features/users/stream_spec.rb b/spec/features/users/stream_spec.rb old mode 100644 new mode 100755 index 136dfb0..4983ed6 --- a/spec/features/users/stream_spec.rb +++ b/spec/features/users/stream_spec.rb @@ -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("
Stream
") 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("
Stream
") expect(page).to have_content(stream_url) end end