gitlab-org--gitlab-foss/spec/observers/users_group_observer_spec.rb

28 lines
673 B
Ruby

require 'spec_helper'
describe UsersGroupObserver do
before(:each) { enable_observers }
after(:each) { disable_observers }
subject { UsersGroupObserver.instance }
before { subject.stub(notification: mock('NotificationService').as_null_object) }
describe "#after_create" do
it "should send email to user" do
subject.should_receive(:notification)
create(:users_group)
end
end
describe "#after_update" do
before do
@membership = create :users_group
end
it "should send email to user" do
subject.should_receive(:notification)
@membership.update_attribute(:group_access, UsersGroup::MASTER)
end
end
end