diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-11-18 19:09:03 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-11-18 19:09:03 +0800 |
commit | 428061678eda85a65ce6a9ee15ac520af45f021a (patch) | |
tree | ed13ba3f26d63d228404db5063a00e87a2310fb9 | |
parent | a41ee7eb5eea96277ee18d474dc2defecb7f7596 (diff) | |
download | gitlab-ce-428061678eda85a65ce6a9ee15ac520af45f021a.tar.gz |
Add tests for key/deploy key notifications
-rw-r--r-- | spec/models/deploy_key_spec.rb | 12 | ||||
-rw-r--r-- | spec/models/key_spec.rb | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/spec/models/deploy_key_spec.rb b/spec/models/deploy_key_spec.rb index 93623e8e99b..3a2252ea40c 100644 --- a/spec/models/deploy_key_spec.rb +++ b/spec/models/deploy_key_spec.rb @@ -5,4 +5,16 @@ describe DeployKey, models: true do it { is_expected.to have_many(:deploy_keys_projects) } it { is_expected.to have_many(:projects) } end + + describe 'notification' do + let(:user) { create(:user) } + + it 'does not send a notification' do + perform_enqueued_jobs do + create(:deploy_key, user: user) + end + + should_not_email(user) + end + end end diff --git a/spec/models/key_spec.rb b/spec/models/key_spec.rb index 1a26cee9f3d..1260f0b5f42 100644 --- a/spec/models/key_spec.rb +++ b/spec/models/key_spec.rb @@ -92,4 +92,16 @@ describe Key, models: true do expect(described_class.new(key: " #{valid_key} ").key).to eq(valid_key) end end + + describe 'notification' do + let(:user) { create(:user) } + + it 'sends a notification' do + perform_enqueued_jobs do + create(:key, user: user) + end + + should_email(user) + end + end end |