gitlabhq/spec/observers/user_observer_spec.rb

24 lines
506 B
Ruby
Raw Normal View History

require 'spec_helper'
describe UserObserver do
subject { UserObserver.instance }
it 'calls #after_create when new users are created' do
new_user = build(:user)
subject.should_receive(:after_create).with(new_user)
2013-01-02 18:46:06 +01:00
new_user.save
end
context 'when a new user is created' do
it 'sends an email' do
2013-01-09 07:14:05 +01:00
Notify.should_receive(:new_user_email)
create(:user)
end
2012-09-12 08:05:12 +02:00
it 'trigger logger' do
Gitlab::AppLogger.should_receive(:info)
2013-01-09 07:14:05 +01:00
create(:user)
2012-09-12 08:05:12 +02:00
end
end
end