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