debian-mirror-gitlab/spec/models/bulk_imports/tracker_spec.rb
2021-04-17 20:07:23 +05:30

29 lines
774 B
Ruby

# frozen_string_literal: true
require 'spec_helper'
RSpec.describe BulkImports::Tracker, type: :model do
describe 'associations' do
it { is_expected.to belong_to(:entity).required }
end
describe 'validations' do
before do
create(:bulk_import_tracker)
end
it { is_expected.to validate_presence_of(:relation) }
it { is_expected.to validate_uniqueness_of(:relation).scoped_to(:bulk_import_entity_id) }
it { is_expected.to validate_presence_of(:stage) }
context 'when has_next_page is true' do
it "validates presence of `next_page`" do
tracker = build(:bulk_import_tracker, has_next_page: true)
expect(tracker).not_to be_valid
expect(tracker.errors).to include(:next_page)
end
end
end
end