Updated test for expected ban behaviour

This commit is contained in:
cblanc 2015-05-05 22:51:26 +01:00
parent 79375b4474
commit 46e30e8a4c

View file

@ -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