diff --git a/app/views/pages/live.html.erb b/app/views/pages/live.html.erb index ffff897c1..2500485f4 100644 --- a/app/views/pages/live.html.erb +++ b/app/views/pages/live.html.erb @@ -42,7 +42,7 @@

DEV LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 55px; height: 50px; vertical-align: text-top;" %>

- Our event is starting soon! Check back very shortly. + Our event is starting soon! Check back very shortly.

<% elsif Flipflop.live_is_live? %>
-

DEV is LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 55px; vertical-align: text-top;" %>

+

DEV IS LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 60px;" %>

<%= render "devise/registrations/registration_form" %>
diff --git a/spec/factories/chat_channels.rb b/spec/factories/chat_channels.rb index 11d04e460..dba10ec1b 100644 --- a/spec/factories/chat_channels.rb +++ b/spec/factories/chat_channels.rb @@ -3,4 +3,8 @@ FactoryBot.define do channel_type { "open" } slug { rand(10000000000).to_s } end + + trait :workshop do + channel_name "Workshop" + end end diff --git a/spec/requests/badges_spec.rb b/spec/requests/badges_spec.rb new file mode 100644 index 000000000..8fdd5871e --- /dev/null +++ b/spec/requests/badges_spec.rb @@ -0,0 +1,13 @@ +require "rails_helper" + +RSpec.describe "Badges", type: :request do + let(:user) { create(:user) } + let(:badge) { create(:badge) } + + describe "GET /badge/:slug" do + it "shows the badge" do + get "/badge/#{badge.slug}" + expect(response.body).to include badge.title + end + end +end diff --git a/spec/requests/pages_spec.rb b/spec/requests/pages_spec.rb index 9756e4fa2..2dc6f3ea2 100644 --- a/spec/requests/pages_spec.rb +++ b/spec/requests/pages_spec.rb @@ -46,7 +46,55 @@ RSpec.describe "Pages", type: :request do describe "GET /sponsorship-info" do it "has proper headline" do get "/sponsorship-info" - expect(response.body).to include ("Sponsorship Information") + expect(response.body).to include("Sponsorship Information") + end + end + + describe "GET /live" do + let(:user) { create(:user) } + + context "when nothing is live" do + it "shows the correct message" do + get "/live" + expect(response.body).to include("Nothing is live right now") + end + end + + context "when live is starting soon" do + before do + test_strategy = Flipflop::FeatureSet.current.test! + test_strategy.switch!(:live_starting_soon, true) + get "/live" + end + + it "shows the correct message" do + expect(response.body).to include("Our event is starting soon") + end + end + + context "when live is live" do + before(:all) do + test_strategy = Flipflop::FeatureSet.current.test! + test_strategy.switch!(:live_is_live, true) + create(:chat_channel, :workshop) + end + + it "shows a sign in page for logged out users" do + get "/live" + expect(response.body).to include("Sign In or Create Your Account") + end + + it "shows the video for logged in users" do + login_as user + get "/live" + expect(response.body).to include("