Merge pull request #62 from Prommah/user-view-cleanup

User view cleanup
This commit is contained in:
simplefl 2015-10-28 18:11:35 +01:00
commit 432b2cb5c8
2 changed files with 28 additions and 15 deletions

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

@ -4,20 +4,32 @@
<dl>
<dt>Age</dt>
<dd><%= @user.age %></dd>
<dt>Country</dt>
<dd><%= @user.country %></dd>
<dt>Town</dt>
<dd><%= @user.profile.town %></dd>
<dt>SteamID</dt>
<dd>
<p><%= @user.steamid %></p>
<div id="steam-search" data-user-id="<%= @user.id %>">
<%= 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.country.blank? %>
<dt>Country</dt>
<dd><%= @user.country %></dd>
<% end %>
<% if !@user.profile.town.blank? %>
<dt>Town</dt>
<dd><%= @user.profile.town %></dd>
<% end %>
<% if !@user.steamid.blank? %>
<dt>SteamID</dt>
<dd>
<p><%= @user.steamid %></p>
<div id="steam-search" data-user-id="<%= @user.id %>">
<%= link_to "Search for Steam Account" %>
</div>
</dd>
<% end %>
<% 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