2015-09-03 18:04:13 +02:00
|
|
|
# encoding: utf-8
|
2015-10-06 18:55:44 +02:00
|
|
|
# author: Dominik Richter
|
|
|
|
# author: Christoph Hartmann
|
2015-09-03 18:04:13 +02:00
|
|
|
|
2015-09-02 04:53:51 +02:00
|
|
|
require 'helper'
|
|
|
|
|
|
|
|
describe 'Vulcano::Plugins::Backend' do
|
2015-09-03 10:12:20 +02:00
|
|
|
let(:cls) { Vulcano::Plugins::Backend }
|
|
|
|
let(:child) { Class.new(cls) }
|
2015-09-02 04:53:51 +02:00
|
|
|
|
|
|
|
it 'provides a name method for registering' do
|
2015-09-03 10:12:20 +02:00
|
|
|
child.must_respond_to :name
|
2015-09-02 04:53:51 +02:00
|
|
|
end
|
2015-09-02 11:53:25 +02:00
|
|
|
|
|
|
|
describe 'when registering a plugin' do
|
2015-09-03 10:12:20 +02:00
|
|
|
let(:registry) { Vulcano::Backend.registry }
|
|
|
|
|
2015-09-02 11:53:25 +02:00
|
|
|
before do
|
2015-09-03 10:12:20 +02:00
|
|
|
child.name 'test'
|
2015-09-02 11:53:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
after do
|
2015-09-03 10:12:20 +02:00
|
|
|
registry.delete('test')
|
2015-09-02 11:53:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'must have the backend registered' do
|
2015-09-03 10:12:20 +02:00
|
|
|
registry.keys.must_include 'test'
|
|
|
|
registry['test'].must_equal child
|
2015-09-02 11:53:25 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'must raise an error if file is not implemented' do
|
2015-09-03 10:12:20 +02:00
|
|
|
t = registry['test'].new
|
2015-09-02 11:53:25 +02:00
|
|
|
proc { t.run_command }.must_raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'must raise an error if run_command is not implemented' do
|
2015-09-03 10:12:20 +02:00
|
|
|
t = registry['test'].new
|
2015-09-02 11:53:25 +02:00
|
|
|
proc { t.file }.must_raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'must raise an error if os is not implemented' do
|
2015-09-03 10:12:20 +02:00
|
|
|
t = registry['test'].new
|
2015-09-02 11:53:25 +02:00
|
|
|
proc { t.os }.must_raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-09-02 04:53:51 +02:00
|
|
|
end
|