debian-mirror-gitlab/spec/models/users/callout_spec.rb

27 lines
945 B
Ruby
Raw Normal View History

2019-07-07 11:18:12 +05:30
# frozen_string_literal: true
2019-12-04 20:38:33 +05:30
require 'spec_helper'
2018-03-17 18:26:18 +05:30
2022-01-26 12:08:38 +05:30
RSpec.describe Users::Callout do
let_it_be(:callout) { create(:callout) }
2018-03-17 18:26:18 +05:30
2019-02-15 15:39:39 +05:30
it_behaves_like 'having unique enum values'
2018-03-17 18:26:18 +05:30
describe 'validations' do
it { is_expected.to validate_presence_of(:feature_name) }
it { is_expected.to validate_uniqueness_of(:feature_name).scoped_to(:user_id).ignoring_case_sensitivity }
end
2022-07-23 23:45:48 +05:30
describe 'scopes' do
describe '.with_feature_name' do
let_it_be(:feature_name) { described_class.feature_names.keys.last }
let_it_be(:user_callouts_for_feature_name) { create_list(:callout, 2, feature_name: feature_name) }
let_it_be(:another_user_callout) { create(:callout, feature_name: described_class.feature_names.each_key.first) }
it 'returns user callouts for the given feature name only' do
expect(described_class.with_feature_name(feature_name)).to eq(user_callouts_for_feature_name)
end
end
end
2018-03-17 18:26:18 +05:30
end