# == Schema Information
#
# Table name: status_types
#
#  id                  :integer          not null, primary key
#  name                :string(255)
#  created_at          :datetime         not null
#  updated_at          :datetime         not null
#  next_status_type_id :integer
#

require 'spec_helper'

describe StatusType do

  before { @status_type = StatusType.new(name: "test status") }

  subject { @status_type }

  it { should respond_to(:name) }
  it { should respond_to(:next_status) }

  describe "when name is missing" do
    before { @status_type.name = "" }
    it { should_not be_valid }
  end

  describe "when name isn't unique" do
    before do
      status_type_dup = @status_type.dup
      status_type_dup.name = @status_type.name.upcase
      status_type_dup.save
    end

    it { should_not be_valid }
  end
end
