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_spec.rb

64 lines
1.5 KiB
Ruby
Raw Normal View History

2018-11-29 20:19:38 -05:00
# frozen_string_literal: true
require 'rails_helper'
2018-11-30 02:00:03 -05:00
RSpec.describe Passport do
subject { create :passport_without_image }
2018-11-29 20:19:38 -05:00
2018-12-02 09:16:16 -05:00
it do
is_expected.to \
have_one(:passport_map)
.dependent(:restrict_with_exception)
end
2018-11-30 03:28:40 -05:00
it do
is_expected.to \
have_many(:passport_confirmations)
.dependent(:restrict_with_exception)
end
2018-12-01 05:23:58 -05:00
pending '#image'
2018-11-30 19:40:34 -05:00
pending '#enough_confirmations?'
2018-12-01 12:18:37 -05:00
describe '#confirmed' do
def allow_value(*)
super.for :confirmed
end
context 'when passport has no image' do
subject { create :passport_without_image }
it { is_expected.to allow_value false }
it { is_expected.not_to allow_value true }
end
context 'when passport has no confirmations' do
subject { create :passport_with_image }
it { is_expected.to allow_value false }
it { is_expected.not_to allow_value true }
end
context 'when passport has almost enough confirmations' do
subject { create :passport_with_almost_enough_confirmations }
it { is_expected.to allow_value false }
it { is_expected.not_to allow_value true }
end
context 'when passport has enough confirmations' do
subject { create :passport_with_enough_confirmations }
it { is_expected.to allow_value false }
it { is_expected.to allow_value true }
end
context 'when passport is confirmed' do
subject { create :confirmed_passport }
it { is_expected.to allow_value false }
it { is_expected.to allow_value true }
end
end
2018-11-29 20:19:38 -05:00
end