require 'rails_helper'

RSpec.describe Seat, type: :model do
  before :all do
    @seat = FactoryGirl.create(:seat)
  end

  subject { @seat }

  it { should respond_to :table }
  it { should respond_to :user }
  it { should respond_to :user_id }
  it { should respond_to :user_soft_token }

  it '#table returns a Table' do
    expect(@seat.table.class).to match Table
  end

  it '#user returns a User' do
    @seat = FactoryGirl.create(:seat, :occupied)
    expect(@seat.user.class).to match User
  end

  it '#user_id returns a Fixnum' do
    @seat = FactoryGirl.create(:seat, :occupied)
    expect(@seat.user_id.class).to match Fixnum
  end

  it '#user_soft_token returns a String' do
    @seat = FactoryGirl.create(:seat, :occupied)
    expect(@seat.user_soft_token.class).to match String
  end

  it "#occupied? returns a Boolean" do
    expect(@seat.occupied?).to eq false
    @seat.user_id = 1
    expect(@seat.occupied?).to eq true
  end
end
