BigW Consortium Gitlab

user_agent_detail_spec.rb 719 Bytes
Newer Older
1 2 3 4
require 'rails_helper'

describe UserAgentDetail, type: :model do
  describe '.submittable?' do
5 6 7
    it 'is submittable when not already submitted' do
      detail = build(:user_agent_detail)

8 9
      expect(detail.submittable?).to be_truthy
    end
10 11 12 13 14 15

    it 'is not submittable when already submitted' do
      detail = build(:user_agent_detail, submitted: true)

      expect(detail.submittable?).to be_falsey
    end
16 17 18
  end

  describe '.valid?' do
19 20 21
    it 'is valid with a subject' do
      detail = build(:user_agent_detail)

22 23
      expect(detail).to be_valid
    end
24 25 26 27 28 29

    it 'is invalid without a subject' do
      detail = build(:user_agent_detail, subject: nil)

      expect(detail).not_to be_valid
    end
30 31
  end
end