Updated test for expected ban behaviour

This commit is contained in:
cblanc 2015-05-05 22:51:26 +01:00
parent 9f5693af9c
commit 8187b1c5bc

View file

@ -1,26 +1,23 @@
require 'spec_helper' require 'spec_helper'
feature 'Shoutbox' do feature 'Shoutbox', js: true do
let!(:user) { create :user }
background do background do
@user = create :user sign_in_as user
sign_in_as @user
visit root_path
end end
feature 'user creates a shout', js: true do scenario 'creating a valid shout' do
scenario 'shouting with valid content' do visit root_path
shout = rand(100000).to_s shout = rand(100000).to_s
fill_in 'shoutbox_text', with: shout fill_in 'shoutbox_text', with: shout
click_button 'Shout!' click_button 'Shout!'
expect(page).to have_content(shout) expect(page).to have_content(shout)
end end
scenario 'unable to while banned' do scenario 'creating shout while banned' do
@user.bans.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days Ban.create! ban_type: Ban::TYPE_MUTE, expiry: Time.now + 10.days, user_name: user.username
shout = rand(100000).to_s visit root_path
fill_in 'shoutbox_text', with: shout expect(find("#sidebar")).to have_content "You have been muted."
click_button 'Shout!'
expect(page).to_not have_content(shout)
end
end end
end end