fix key observer tests
This commit is contained in:
parent
299a9a1040
commit
1c931fb814
|
@ -15,7 +15,7 @@ class ProjectObserver < ActiveRecord::Observer
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_create project
|
def after_create project
|
||||||
log_info("#{project.owner.name} created a new project \"#{project.name}\"")
|
log_info("#{project.owner.name} created a new project \"#{project.name_with_namespace}\"")
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
|
@ -9,25 +9,19 @@ describe KeyObserver do
|
||||||
is_deploy_key: false
|
is_deploy_key: false
|
||||||
)
|
)
|
||||||
|
|
||||||
@gitolite = double('Gitlab::Gitolite',
|
|
||||||
set_key: true,
|
|
||||||
remove_key: true
|
|
||||||
)
|
|
||||||
|
|
||||||
@observer = KeyObserver.instance
|
@observer = KeyObserver.instance
|
||||||
@observer.stub(gitolite: @gitolite)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context :after_save do
|
context :after_save do
|
||||||
it do
|
it do
|
||||||
@gitolite.should_receive(:set_key).with(@key.identifier, @key.key, @key.projects)
|
GitoliteWorker.should_receive(:perform_async).with(:set_key, @key.identifier, @key.key, @key.projects.map(&:id))
|
||||||
@observer.after_save(@key)
|
@observer.after_save(@key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context :after_destroy do
|
context :after_destroy do
|
||||||
it do
|
it do
|
||||||
@gitolite.should_receive(:remove_key).with(@key.identifier, @key.projects)
|
GitoliteWorker.should_receive(:perform_async).with(:remove_key, @key.identifier, @key.projects.map(&:id))
|
||||||
@observer.after_destroy(@key)
|
@observer.after_destroy(@key)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue