diff options
author | Rémy Coutable <remy@rymai.me> | 2018-08-01 15:21:24 +0000 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-08-01 15:21:24 +0000 |
commit | 83a0db0c551236518bdec1a7ae3a1ed1d05f5aaa (patch) | |
tree | e13ad022ea223e7bde5202a31ee81169225fec99 /spec/models | |
parent | ea6fc714bb0306ac8ca56b5dafe4b6777aafe5fc (diff) | |
parent | 12095251c3777c5231cab97854d5dca69d31cc5d (diff) | |
download | gitlab-ce-83a0db0c551236518bdec1a7ae3a1ed1d05f5aaa.tar.gz |
Merge branch 'bvl-user-status-message-35463' into 'master'
Allow users to set a status
Closes #35463
See merge request gitlab-org/gitlab-ce!20614
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/user_spec.rb | 1 | ||||
-rw-r--r-- | spec/models/user_status_spec.rb | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 982d24e7eab..f5e2c977104 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -20,6 +20,7 @@ describe User do describe 'associations' do it { is_expected.to have_one(:namespace) } + it { is_expected.to have_one(:status) } it { is_expected.to have_many(:snippets).dependent(:destroy) } it { is_expected.to have_many(:members) } it { is_expected.to have_many(:project_members) } diff --git a/spec/models/user_status_spec.rb b/spec/models/user_status_spec.rb new file mode 100644 index 00000000000..fcc01cdae3d --- /dev/null +++ b/spec/models/user_status_spec.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe UserStatus do + it { is_expected.to validate_presence_of(:user) } + + it { is_expected.to allow_value('smirk').for(:emoji) } + it { is_expected.not_to allow_value('hello world').for(:emoji) } + it { is_expected.not_to allow_value('').for(:emoji) } + + it { is_expected.to validate_length_of(:message).is_at_most(100) } + it { is_expected.to allow_value('').for(:message) } + + it 'is expected to be deleted when the user is deleted' do + status = create(:user_status) + + expect { status.user.destroy }.to change { described_class.count }.from(1).to(0) + end +end |