Tests for /live and minor style adjustments (#462)
* Add spec for badges show page * Test live feature and minor styling changes
This commit is contained in:
parent
6f1efb0342
commit
e2184d2ff0
4 changed files with 68 additions and 3 deletions
|
|
@ -42,7 +42,7 @@
|
|||
<div class="live-upcoming-info">
|
||||
<h1 style="text-align: center"><span style="display: inline-block">DEV LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 55px; height: 50px; vertical-align: text-top;" %></span></h1>
|
||||
<h4 style="text-align: center">
|
||||
<i>Our event is starting soon! Check back very shortly.
|
||||
<i>Our event is starting soon! Check back very shortly.
|
||||
</h4>
|
||||
</div>
|
||||
<script>
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
</script>
|
||||
<% elsif Flipflop.live_is_live? %>
|
||||
<div class="live-upcoming-info">
|
||||
<h1 style="text-align: center;font-size:3.5em;margin:-100px auto">DEV is <span style="display: inline-block">LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 55px; vertical-align: text-top;" %></span></h1>
|
||||
<h1 style="text-align: center;font-size:3.5em;margin:-100px auto">DEV IS <span style="display: inline-block">LIVE <%= image_tag "emoji/emoji-one-television.png", style: "width: 60px;" %></span></h1>
|
||||
<%= render "devise/registrations/registration_form" %>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -3,4 +3,8 @@ FactoryBot.define do
|
|||
channel_type { "open" }
|
||||
slug { rand(10000000000).to_s }
|
||||
end
|
||||
|
||||
trait :workshop do
|
||||
channel_name "Workshop"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
13
spec/requests/badges_spec.rb
Normal file
13
spec/requests/badges_spec.rb
Normal file
|
|
@ -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
|
||||
|
|
@ -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("<iframe class=\"live-video\"")
|
||||
end
|
||||
|
||||
it "shows the chat for logged in users" do
|
||||
login_as user
|
||||
get "/live"
|
||||
expect(response.body).to include("<div id=\"chat\"")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue