From 31f4a3a5dcc0bf8b9faa513f15a2b1db5f89773d Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Thu, 27 Aug 2015 18:47:26 +0100 Subject: [PATCH 1/4] Show stream information on user page --- app/views/users/_general.html.erb | 3 +++ spec/features/users/stream_spec.rb | 28 ++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 spec/features/users/stream_spec.rb diff --git a/app/views/users/_general.html.erb b/app/views/users/_general.html.erb index 4dfb4c6..793668e 100644 --- a/app/views/users/_general.html.erb +++ b/app/views/users/_general.html.erb @@ -15,6 +15,9 @@ <%= link_to "Search for Steam Account" %> +
Stream
+
<%= @user.profile.stream.blank? ? "No Stream Provided" : @user.profile.stream %>
+

Contact

diff --git a/spec/features/users/stream_spec.rb b/spec/features/users/stream_spec.rb new file mode 100644 index 0000000..88ed1cf --- /dev/null +++ b/spec/features/users/stream_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +feature 'User Stream Information' do + let(:password) { "foobar" } + let!(:user) { create :user, raw_password: password } + + feature 'stream administration' do + scenario 'user updates their stream' do + visit user_path(user) + expect(page).to have_content("No Stream Provided") + fill_login_form(user, password) + click_button submit(:user, :login) + visit edit_user_path(user) + stream_url = "twitch.tv/gold_n" + expect(page).to have_content("Stream") + fill_in "user_profile_attributes_stream", with: stream_url + click_button "Update Profile" + expect(page).to have_content(I18n.t(:users_update)) + visit user_path(user) + expect(page).to have_content(stream_url) + end + end + + def fill_login_form(user, password) + fill_in "login_username", with: user.username + fill_in "login_password", with: password + end +end From a4bf9f49acdff1bbd5dbccf6b2509a770cb54d68 Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Thu, 27 Aug 2015 18:49:47 +0100 Subject: [PATCH 2/4] Fix style --- spec/features/users/stream_spec.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spec/features/users/stream_spec.rb b/spec/features/users/stream_spec.rb index 88ed1cf..136dfb0 100644 --- a/spec/features/users/stream_spec.rb +++ b/spec/features/users/stream_spec.rb @@ -1,11 +1,11 @@ -require 'spec_helper' +require "spec_helper" -feature 'User Stream Information' do +feature "User Stream Information" do let(:password) { "foobar" } let!(:user) { create :user, raw_password: password } - feature 'stream administration' do - scenario 'user updates their stream' do + feature "stream administration" do + scenario "user updates their stream" do visit user_path(user) expect(page).to have_content("No Stream Provided") fill_login_form(user, password) From 3bc78d58fca1d4d58c5aa301557dcf43216ed75f Mon Sep 17 00:00:00 2001 From: Chris Blanchard Date: Fri, 18 Sep 2015 13:35:17 +0100 Subject: [PATCH 3/4] Add helper method for new gathers url --- app/helpers/application_helper.rb | 8 ++++++++ app/views/application/_navigation.html.erb | 22 +++++++++++++++++++--- app/views/gathers/show.html.erb | 4 ++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 9b9d542..561202d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -189,4 +189,12 @@ module ApplicationHelper def latest_rules article_path(Article::RULES) end + + def gathers_url + if Rails.env.production? + "http://gathers.ensl.org" + else + "http://gathers.staging.ensl.org" + end + end end diff --git a/app/views/application/_navigation.html.erb b/app/views/application/_navigation.html.erb index ad687f7..ea46bd0 100644 --- a/app/views/application/_navigation.html.erb +++ b/app/views/application/_navigation.html.erb @@ -25,14 +25,19 @@