mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-12-27 04:51:14 +00:00
Updated test for expected ban behaviour
This commit is contained in:
parent
f7960bd7c0
commit
c07b691b8f
1 changed files with 16 additions and 19 deletions
|
@ -1,26 +1,23 @@
|
|||
require 'spec_helper'
|
||||
|
||||
feature 'Shoutbox' do
|
||||
feature 'Shoutbox', js: true do
|
||||
let!(:user) { create :user }
|
||||
|
||||
background do
|
||||
@user = create :user
|
||||
sign_in_as @user
|
||||
visit root_path
|
||||
sign_in_as user
|
||||
end
|
||||
|
||||
feature 'user creates a shout', js: true do
|
||||
scenario 'shouting with valid content' do
|
||||
shout = rand(100000).to_s
|
||||
fill_in 'shoutbox_text', with: shout
|
||||
click_button 'Shout!'
|
||||
expect(page).to have_content(shout)
|
||||
end
|
||||
scenario 'creating a valid shout' do
|
||||
visit root_path
|
||||
shout = rand(100000).to_s
|
||||
fill_in 'shoutbox_text', with: shout
|
||||
click_button 'Shout!'
|
||||
expect(page).to have_content(shout)
|
||||
end
|
||||
|
||||
scenario 'unable to while banned' do
|
||||
@user.bans.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days
|
||||
shout = rand(100000).to_s
|
||||
fill_in 'shoutbox_text', with: shout
|
||||
click_button 'Shout!'
|
||||
expect(page).to_not have_content(shout)
|
||||
end
|
||||
end
|
||||
scenario 'creating shout while banned' do
|
||||
Ban.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days, user_name: user.username
|
||||
visit root_path
|
||||
expect(find("#sidebar")).to have_content "You have been muted."
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue