1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/spec/models/passport_confirmation_spec.rb

48 lines
1.2 KiB
Ruby
Raw Normal View History

2018-11-30 03:13:54 -05:00
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe PassportConfirmation do
subject { create :passport_confirmation }
it { is_expected.to belong_to(:passport).required }
2018-12-01 21:28:34 -05:00
it { is_expected.to belong_to(:account).required }
2018-11-30 03:13:54 -05:00
2018-12-01 20:12:16 -05:00
it { is_expected.to validate_presence_of(:passport).with_message(:required) }
2018-12-01 21:28:34 -05:00
it { is_expected.to validate_presence_of(:account).with_message(:required) }
2018-12-01 20:12:16 -05:00
2018-11-30 03:13:54 -05:00
it do
2018-12-01 21:28:34 -05:00
is_expected.to validate_uniqueness_of(:account_id).scoped_to(:passport_id)
2018-11-30 03:13:54 -05:00
end
2018-12-01 06:05:50 -05:00
2018-12-02 11:44:02 -05:00
it { is_expected.not_to allow_value(create(:empty_passport)).for :passport }
it do
is_expected.not_to \
2018-12-02 11:44:02 -05:00
allow_value(create(:passport_with_passport_map)).for :passport
end
it do
is_expected.not_to \
allow_value(create(:passport_with_image)).for :passport
end
it do
is_expected.to \
allow_value(create(:passport_with_passport_map_and_image)).for :passport
end
it do
is_expected.to \
allow_value(create(:passport_with_almost_enough_confirmations))
.for :passport
end
it do
is_expected.to \
allow_value(create(:passport_with_enough_confirmations)).for :passport
end
2018-12-01 06:05:50 -05:00
it { is_expected.to allow_value(create(:confirmed_passport)).for :passport }
2018-11-30 03:13:54 -05:00
end