Sha256: e8d16cba5e202eb9a1fe607d082a83fae4df324d7723fac7182327e635b03b20

Contents?: true

Size: 1.33 KB

Versions: 5

Compression:

Stored size: 1.33 KB

Contents

require 'rails_helper'

module Mks
  module Rate
    RSpec.describe RateChangeRequest, type: :model do
      it 'has valid factory' do
        expect(create(:rate_change_request)).to be_valid
      end

      it 'is invalid without authorization date' do
        expect(build(:rate_change_request, authorized_on: nil)).not_to be_valid
      end

      it 'is invalid without reference number' do
        expect(build(:rate_change_request, reference_number: nil)).not_to be_valid
      end

      it 'is invalid with duplicate reference number' do
        rcr = create(:rate_change_request)
        expect(build(:rate_change_request, reference_number: rcr.reference_number)).not_to be_valid
      end

      it 'is invalid without authorized by' do
        expect(build(:rate_change_request, authorized_by: nil)).not_to be_valid
      end

      it 'is invalid without effective date' do
        expect(build(:rate_change_request, effective_on: nil)).not_to be_valid
      end

      it 'is invalid without rate' do
        expect(build(:rate_change_request, rates: {})).not_to be_valid
      end

      it 'is invalid without status' do
        expect(build(:rate_change_request, status: nil)).not_to be_valid
      end

      it 'is valid without approved by' do
        expect(create(:rate_change_request, approved_by: nil)).to be_valid
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
mks_rate-1.0.5 spec/models/mks/rate/rate_change_request_spec.rb
mks_rate-1.0.4 spec/models/mks/rate/rate_change_request_spec.rb
mks_rate-1.0.3 spec/models/mks/rate/rate_change_request_spec.rb
mks_rate-1.0.2 spec/models/mks/rate/rate_change_request_spec.rb
mks_rate-1.0.1 spec/models/mks/rate/rate_change_request_spec.rb