summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 21:36:40 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-06-17 21:36:40 +0300
commit9e3094b232fe5343e5986f0e6a072a5194e18ada (patch)
tree4fa066af51eeadebdbe265da221347f9430c01d1 /spec
parentb3a90aba41a040378530cb9f1980497e16bbdb11 (diff)
downloadgitlab-ce-9e3094b232fe5343e5986f0e6a072a5194e18ada.tar.gz
Remove UsersGroup observer
Diffstat (limited to 'spec')
-rw-r--r--spec/models/users_group_spec.rb28
-rw-r--r--spec/observers/users_group_observer_spec.rb32
2 files changed, 28 insertions, 32 deletions
diff --git a/spec/models/users_group_spec.rb b/spec/models/users_group_spec.rb
index acecae07146..05dd97d92d4 100644
--- a/spec/models/users_group_spec.rb
+++ b/spec/models/users_group_spec.rb
@@ -37,4 +37,32 @@ describe UsersGroup do
it { should respond_to(:user_name) }
it { should respond_to(:user_email) }
end
+
+ context 'notification' do
+ describe "#after_create" do
+ it "should send email to user" do
+ membership = build(:users_group)
+ membership.stub(notification_service: double('NotificationService').as_null_object)
+ membership.should_receive(:notification_service)
+ membership.save
+ end
+ end
+
+ describe "#after_update" do
+ before do
+ @membership = create :users_group
+ @membership.stub(notification_service: double('NotificationService').as_null_object)
+ end
+
+ it "should send email to user" do
+ @membership.should_receive(:notification_service)
+ @membership.update_attribute(:group_access, UsersGroup::MASTER)
+ end
+
+ it "does not send an email when the access level has not changed" do
+ @membership.should_not_receive(:notification_service)
+ @membership.update_attribute(:group_access, UsersGroup::OWNER)
+ end
+ end
+ end
end
diff --git a/spec/observers/users_group_observer_spec.rb b/spec/observers/users_group_observer_spec.rb
deleted file mode 100644
index 2ab99c33b78..00000000000
--- a/spec/observers/users_group_observer_spec.rb
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'spec_helper'
-
-describe UsersGroupObserver do
- before(:each) { enable_observers }
- after(:each) { disable_observers }
-
- subject { UsersGroupObserver.instance }
- before { subject.stub(notification: double('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
-
- it "does not send an email when the access level has not changed" do
- subject.should_not_receive(:notification)
- @membership.update_attribute(:group_access, UsersGroup::OWNER)
- end
- end
-end