debian-mirror-gitlab/spec/models/deploy_key_spec.rb

44 lines
897 B
Ruby
Raw Normal View History

2019-05-18 00:54:41 +05:30
# frozen_string_literal: true
2014-09-02 18:07:02 +05:30
require 'spec_helper'
2017-09-10 17:25:29 +05:30
describe DeployKey, :mailer do
2014-09-02 18:07:02 +05:30
describe "Associations" do
2015-04-26 12:48:37 +05:30
it { is_expected.to have_many(:deploy_keys_projects) }
it { is_expected.to have_many(:projects) }
2014-09-02 18:07:02 +05:30
end
2017-08-17 22:00:37 +05:30
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
2018-05-09 12:01:36 +05:30
describe '#user' do
let(:deploy_key) { create(:deploy_key) }
let(:user) { create(:user) }
context 'when user is set' do
before do
deploy_key.user = user
end
it 'returns the user' do
expect(deploy_key.user).to be(user)
end
end
context 'when user is not set' do
it 'returns the ghost user' do
expect(deploy_key.user).to eq(User.ghost)
end
end
end
2014-09-02 18:07:02 +05:30
end