Commit 2ab76ca5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Fix UserProject obserse spec

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent d75eb243
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,
......
......@@ -7,7 +7,7 @@ describe UsersProjectObserver do
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
......@@ -35,7 +35,7 @@ describe UsersProjectObserver 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
......@@ -45,7 +45,7 @@ describe UsersProjectObserver do
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
......@@ -91,4 +91,4 @@ describe UsersProjectObserver do
end
end
end
end
\ No newline at end of file
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment