Skip to content
Snippets Groups Projects
Verified Commit 2ab76ca5 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Fix UserProject obserse spec

parent d75eb243
No related branches found
No related tags found
1 merge request!1Fix Links To Gitlab Cloud
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,
Loading
Loading
Loading
Loading
@@ -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
Loading
Loading
@@ -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
 
Loading
Loading
@@ -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
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment