diff --git a/spec/models/user_callout_spec.rb b/spec/models/user_callout_spec.rb index d845fdf33a5..dd63aee2145 100644 --- a/spec/models/user_callout_spec.rb +++ b/spec/models/user_callout_spec.rb @@ -1,10 +1,10 @@ require 'rails_helper' describe UserCallout do - let!(:callout) { create(:user_callout) } - it_behaves_like 'Unique enum values' + let!(:callout) { create(:user_callout) } + describe 'relationships' do it { is_expected.to belong_to(:user) } end diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index c43921bb0f0..cbde085006d 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -4,6 +4,8 @@ describe User do include ProjectForksHelper include TermsHelper + it_behaves_like 'Unique enum values' + describe 'modules' do subject { described_class } @@ -159,8 +161,6 @@ describe User do it { is_expected.to validate_length_of(:bio).is_at_most(255) } - it_behaves_like 'Unique enum values' - it_behaves_like 'an object with email-formated attributes', :email do subject { build(:user) } end diff --git a/spec/support/active_record_enum.rb b/spec/support/active_record_enum.rb index ab38c0f8aea..8c3cc8d1804 100644 --- a/spec/support/active_record_enum.rb +++ b/spec/support/active_record_enum.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true shared_examples 'Unique enum values' do - described_class.defined_enums.each do |name, hash| - it "has unique values in #{name}" do - duplicated = hash.group_by(&:last).select { |key, value| value.size > 1 } + described_class.defined_enums.each do |name, enum| + it "has unique values in #{name.inspect}" do + duplicated = enum.group_by(&:last).select { |key, value| value.size > 1 } expect(duplicated).to be_empty, "Duplicated values detected: #{duplicated.values.map(&Hash.method(:[]))}"