require 'spec_helper'

describe UserBlacklist do

  let(:user) { FactoryGirl.create(:user) }
  
  describe "#banned" do
    it "returns false if no ban" do
      UserBlacklist.banned(user).should eq false
    end

    it "returns true if banned" do
      FactoryGirl.create(:user_blacklist, user: user)
      UserBlacklist.banned(user).should eq true
    end

    it "returns false if whitelisted" do
      FactoryGirl.create(:user_whitelist, user: user)
      UserBlacklist.banned(user).should eq false
    end


    it "returns false if whitelisted and blacklisted too" do
      FactoryGirl.create(:user_blacklist, user: user)
      FactoryGirl.create(:user_whitelist, user: user)
      UserBlacklist.banned(user).should eq false
    end
  end
end