class UsersProjectObserver < BaseObserver
- def after_commit(users_project)
- return if users_project.destroyed?
- end
-
def after_create(users_project)
Event.create(
project_id: users_project.project.id,
let(:user) { create(:user) }
let(:project) { create(:project) }
subject { UsersProjectObserver.instance }
- before { subject.stub(notification: mock('NotificationService').as_null_object) }
+ before { subject.stub(notification: double('NotificationService').as_null_object) }
describe "#after_commit" do
it "should called when UsersProject created" do
end
it "should called when UsersProject updated" do
- subject.should_receive(:after_commit)
+ subject.should_receive(:after_update)
@users_project.update_attribute(:project_access, UsersProject::MASTER)
end
end
it "should not called after UsersProject destroyed" do
- subject.should_not_receive(:after_commit)
+ subject.should_not_receive(:after_update)
@users_project.destroy
end
end
end
end
end
-end
\ No newline at end of file
+end