diff options
author | Robert Speicher <rspeicher@gmail.com> | 2015-05-02 23:11:21 -0400 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-05-26 15:48:30 -0400 |
commit | c0faf91ff23815404a95cf4510b43dcf5e331c4f (patch) | |
tree | 81769f125569dd6ea012920544ada1e8666ba4e5 /spec/models/user_spec.rb | |
parent | b06dc74d611192744d34acda944d7ed9e554342a (diff) | |
download | gitlab-ce-c0faf91ff23815404a95cf4510b43dcf5e331c4f.tar.gz |
Add `to_reference` for models that support references
Now there is a single source of information for which attribute a model
uses to be referenced, and its special character.
Diffstat (limited to 'spec/models/user_spec.rb')
-rw-r--r-- | spec/models/user_spec.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 0dddcd5bda2..87f95f9af87 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -63,7 +63,17 @@ require 'spec_helper' describe User do include Gitlab::CurrentSettings - describe "Associations" do + describe 'modules' do + subject { described_class } + + it { is_expected.to include_module(Gitlab::ConfigHelper) } + it { is_expected.to include_module(Gitlab::CurrentSettings) } + it { is_expected.to include_module(Referable) } + it { is_expected.to include_module(Sortable) } + it { is_expected.to include_module(TokenAuthenticatable) } + end + + describe 'associations' do it { is_expected.to have_one(:namespace) } it { is_expected.to have_many(:snippets).class_name('Snippet').dependent(:destroy) } it { is_expected.to have_many(:project_members).dependent(:destroy) } @@ -175,6 +185,14 @@ describe User do it { is_expected.to respond_to(:private_token) } end + describe '#to_reference' do + let(:user) { create(:user) } + + it 'returns a String reference to the object' do + expect(user.to_reference).to eq "@#{user.username}" + end + end + describe '#generate_password' do it "should execute callback when force_random_password specified" do user = build(:user, force_random_password: true) |