BigW Consortium Gitlab

Commit 30a6fb64 by Shinya Maeda

Fix atomic internal id spec to allow generate pipeline

parent 40e17727
...@@ -11,21 +11,16 @@ shared_examples_for 'AtomicInternalId' do ...@@ -11,21 +11,16 @@ shared_examples_for 'AtomicInternalId' do
end end
describe 'Validation' do describe 'Validation' do
subject { instance }
before do before do
allow(InternalId).to receive(:generate_next).and_return(nil) allow_any_instance_of(described_class).to receive(:ensure_iid!) {}
end end
it 'checks presence' do it 'validates presence' do
if validate_presence instance.valid?
is_expected.to validate_presence_of(internal_id_attribute)
else
is_expected.not_to validate_presence_of(internal_id_attribute)
end
end
it { is_expected.to validate_numericality_of(internal_id_attribute) } expect(instance.errors[:iid]).to include("can't be blank") if validate_presence
expect(instance.errors[:iid]).to include("is not a number") # numericality
end
end end
describe 'Creating an instance' do describe 'Creating an instance' do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment