Spec tidying

This commit is contained in:
Prommah 2015-11-07 06:21:31 +00:00
parent b55ff01ff5
commit dd899cddb0
10 changed files with 35 additions and 35 deletions

2
spec/factories/article.rb Normal file → Executable file
View file

@ -1,6 +1,6 @@
FactoryGirl.define do FactoryGirl.define do
factory :article do factory :article do
sequence(:title) { |n| "Article #{n}" } sequence(:title) { |n| "Article #{n}" }
sequence(:text) { |n| (0..100).map{ (0...8).map { (65 + rand(26)).chr }.join }.join(" ") } sequence(:text) { (0..100).map { (0...8).map { (65 + rand(26)).chr }.join }.join(" ") }
end end
end end

2
spec/factories/ban.rb Normal file → Executable file
View file

@ -1,7 +1,7 @@
FactoryGirl.define do FactoryGirl.define do
factory :ban do factory :ban do
ban_type Ban::TYPE_SITE ban_type Ban::TYPE_SITE
expiry Date.today + 1 expiry Time.now.utc.to_date + 1
# Hack because of the awkward way bans are created (requires user_name) # Hack because of the awkward way bans are created (requires user_name)
before(:create) do |ban| before(:create) do |ban|
if ban.user.nil? if ban.user.nil?

0
spec/factories/category.rb Normal file → Executable file
View file

0
spec/factories/gather.rb Normal file → Executable file
View file

0
spec/factories/grouper.rb Normal file → Executable file
View file

0
spec/factories/issue.rb Normal file → Executable file
View file

0
spec/factories/message.rb Normal file → Executable file
View file

0
spec/factories/server.rb Normal file → Executable file
View file

0
spec/factories/team.rb Normal file → Executable file
View file

6
spec/models/user_spec.rb Normal file → Executable file
View file

@ -22,7 +22,7 @@
# salt :string(255) # salt :string(255)
# #
require 'spec_helper' require "spec_helper"
describe User do describe User do
let!(:user) { create :user } let!(:user) { create :user }
@ -34,7 +34,7 @@ describe User do
it "returns true if user is banned" do it "returns true if user is banned" do
Ban.create!(ban_type: Ban::TYPE_SITE, Ban.create!(ban_type: Ban::TYPE_SITE,
expiry: Time.now + 10.days, expiry: Time.now.utc + 10.days,
user_name: user.username) user_name: user.username)
expect(user.banned?).to be_truthy expect(user.banned?).to be_truthy
@ -42,7 +42,7 @@ describe User do
it "returns true for specific bans" do it "returns true for specific bans" do
Ban.create!(ban_type: Ban::TYPE_MUTE, Ban.create!(ban_type: Ban::TYPE_MUTE,
expiry: Time.now + 10.days, expiry: Time.now.utc + 10.days,
user_name: user.username) user_name: user.username)
expect(user.banned? Ban::TYPE_MUTE).to be_truthy expect(user.banned? Ban::TYPE_MUTE).to be_truthy