mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-02-04 23:41:12 +00:00
Add WIP gather spec
This commit is contained in:
parent
0ea0bca438
commit
54dec5685f
2 changed files with 50 additions and 28 deletions
|
@ -45,7 +45,7 @@ class GatherersController < ApplicationController
|
||||||
@gatherer.update_attribute(:status, states[params[:status]])
|
@gatherer.update_attribute(:status, states[params[:status]])
|
||||||
end
|
end
|
||||||
|
|
||||||
render :nothing => true, :status => 200
|
render body: nil, :status => 200
|
||||||
end
|
end
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
|
|
|
@ -4,34 +4,56 @@ feature 'Gathers', js: true do
|
||||||
let!(:user) { create :user }
|
let!(:user) { create :user }
|
||||||
let!(:gather) { create :gather, :running }
|
let!(:gather) { create :gather, :running }
|
||||||
|
|
||||||
feature 'Shoutbox' do
|
background do
|
||||||
background do
|
sign_in_as user
|
||||||
sign_in_as user
|
end
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'create shout' do
|
scenario 'Try to join without checking TOS' do
|
||||||
visit gather_path(gather)
|
visit gather_path(gather)
|
||||||
shout = rand(100000).to_s
|
|
||||||
fill_in "shout_Gather_#{gather.id}_text", with: shout
|
|
||||||
click_button 'Shout!'
|
|
||||||
expect(page).to have_content(shout)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'enter more than 100 characters' do
|
find('a#gatherJoinBtn').trigger('click')
|
||||||
valid_shout = 100.times.map { "a" }.join
|
|
||||||
invalid_shout = 101.times.map { "a" }.join
|
|
||||||
visit gather_path(gather)
|
|
||||||
expect(page).to_not have_content("Maximum shout length exceeded")
|
|
||||||
fill_in "shout_Gather_#{gather.id}_text", with: invalid_shout
|
|
||||||
expect(page).to have_content("Maximum shout length exceeded")
|
|
||||||
fill_in "shout_Gather_#{gather.id}_text", with: valid_shout
|
|
||||||
expect(page).to_not have_content("Maximum shout length exceeded")
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'creating shout while banned' do
|
# TODO: check error
|
||||||
Ban.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days, user_name: user.username
|
expect(page).to have_content("Confirm must be accepted")
|
||||||
visit root_path
|
expect(gather.gatherers.count).to eq(0)
|
||||||
expect(find("#sidebar")).to have_content "You have been muted."
|
end
|
||||||
end
|
|
||||||
end
|
scenario 'Join (1 player)' do
|
||||||
|
visit gather_path(gather)
|
||||||
|
|
||||||
|
check 'gatherer[confirm]'
|
||||||
|
find('a#gatherJoinBtn').trigger('click')
|
||||||
|
|
||||||
|
expect(page).to have_content(I18n.t(:gathers_join))
|
||||||
|
expect(gather.gatherers.count).to eq(1)
|
||||||
|
expect(gather.gatherers.last.user_id).to eq(user.id)
|
||||||
|
end
|
||||||
|
|
||||||
|
# NOTE: this might break due to afk kicker
|
||||||
|
scenario 'Join (12 players)' do
|
||||||
|
sign_out
|
||||||
|
|
||||||
|
expect(gather.status).to eq(Gather::STATE_RUNNING)
|
||||||
|
|
||||||
|
users = create_list(:user, 11)
|
||||||
|
users << user
|
||||||
|
users.each do |u|
|
||||||
|
sign_in_as u
|
||||||
|
|
||||||
|
visit gather_path(gather)
|
||||||
|
check 'gatherer[confirm]'
|
||||||
|
find('a#gatherJoinBtn').trigger('click')
|
||||||
|
|
||||||
|
expect(page).to have_content(I18n.t(:gathers_join))
|
||||||
|
expect(gather.gatherers.last.user_id).to eq(u.id)
|
||||||
|
sign_out
|
||||||
|
end
|
||||||
|
|
||||||
|
expect(gather.gatherers.count).to eq(12)
|
||||||
|
# expect(gather.status).to eq(Gather::STATE_VOTING)
|
||||||
|
|
||||||
|
sign_in_as user
|
||||||
|
visit gather_path(gather)
|
||||||
|
# sleep(90)
|
||||||
|
end
|
||||||
end
|
end
|
Loading…
Reference in a new issue