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 2e739bdd03
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> <dl>
<dt>Age</dt> <dt>Age</dt>
<dd><%= @user.age %></dd> <dd><%= @user.age %></dd>
<dt>Country</dt>
<dd><%= @user.country %></dd> <% if !@user.country.blank? %>
<dt>Town</dt> <dt>Country</dt>
<dd><%= @user.profile.town %></dd> <dd><%= @user.country %></dd>
<dt>SteamID</dt> <% end %>
<dd>
<p><%= @user.steamid %></p> <% if !@user.profile.town.blank? %>
<div id="steam-search" data-user-id="<%= @user.id %>"> <dt>Town</dt>
<%= link_to "Search for Steam Account" %> <dd><%= @user.profile.town %></dd>
</div> <% end %>
</dd>
<dt>Stream</dt> <% if !@user.steamid.blank? %>
<dd><%= @user.profile.stream.blank? ? "No Stream Provided" : @user.profile.stream %></dd> <dt>SteamID</dt>
</dd> <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> </dl>
<h4>Contact</h4> <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 feature "stream administration" do
scenario "user updates their stream" do scenario "user updates their stream" do
visit user_path(user) 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) fill_login_form(user, password)
click_button submit(:user, :login) click_button submit(:user, :login)
visit edit_user_path(user) visit edit_user_path(user)
@ -17,6 +17,7 @@ feature "User Stream Information" do
click_button "Update Profile" click_button "Update Profile"
expect(page).to have_content(I18n.t(:users_update)) expect(page).to have_content(I18n.t(:users_update))
visit user_path(user) visit user_path(user)
expect(page.html).to include("<dt>Stream</dt>")
expect(page).to have_content(stream_url) expect(page).to have_content(stream_url)
end end
end end