summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2018-05-10 15:56:47 +0900
committerShinya Maeda <shinya@gitlab.com>2018-05-10 15:56:47 +0900
commit30a6fb64dbce39cc0298e805935bb242c2d7b715 (patch)
tree105ebba67196f8c831d69b1d847682815a0d60b1
parent40e17727c72904d947b2c281918e4dad71656f62 (diff)
downloadgitlab-ce-30a6fb64dbce39cc0298e805935bb242c2d7b715.tar.gz
Fix atomic internal id spec to allow generate pipeline
-rw-r--r--spec/support/shared_examples/models/atomic_internal_id_spec.rb19
1 files changed, 7 insertions, 12 deletions
diff --git a/spec/support/shared_examples/models/atomic_internal_id_spec.rb b/spec/support/shared_examples/models/atomic_internal_id_spec.rb
index 1bccb578d79..cd6465675b5 100644
--- a/spec/support/shared_examples/models/atomic_internal_id_spec.rb
+++ b/spec/support/shared_examples/models/atomic_internal_id_spec.rb
@@ -1,6 +1,6 @@
require 'spec_helper'
-shared_examples_for 'AtomicInternalId' do
+shared_examples_for 'AtomicInternalId' do
let(:validate_presence) { true }
describe '.has_internal_id' do
@@ -11,21 +11,16 @@ shared_examples_for 'AtomicInternalId' do
end
describe 'Validation' do
- subject { instance }
-
before do
- allow(InternalId).to receive(:generate_next).and_return(nil)
+ allow_any_instance_of(described_class).to receive(:ensure_iid!) {}
end
- it 'checks presence' do
- if validate_presence
- is_expected.to validate_presence_of(internal_id_attribute)
- else
- is_expected.not_to validate_presence_of(internal_id_attribute)
- end
- end
+ it 'validates presence' do
+ instance.valid?
- 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
describe 'Creating an instance' do