2013-03-25 17:43:23 -04:00
|
|
|
Shindo.tests("Fog::Compute[:digitalocean] | ssh_key model", ['digitalocean', 'compute']) do
|
|
|
|
|
|
|
|
service = Fog::Compute[:digitalocean]
|
|
|
|
|
|
|
|
tests('The ssh_key model should') do
|
2013-07-11 23:48:11 -04:00
|
|
|
|
2013-03-25 17:43:23 -04:00
|
|
|
test('#save') do
|
|
|
|
@key = service.ssh_keys.create :name => 'fookey',
|
|
|
|
:ssh_pub_key => 'fookey'
|
|
|
|
@key.is_a? Fog::Compute::DigitalOcean::SshKey
|
|
|
|
end
|
2013-07-12 10:22:08 -04:00
|
|
|
|
2013-03-25 17:43:23 -04:00
|
|
|
tests('have the action') do
|
|
|
|
test('reload') { @key.respond_to? 'reload' }
|
2013-07-11 23:48:11 -04:00
|
|
|
%w{
|
2013-03-25 17:43:23 -04:00
|
|
|
save
|
|
|
|
destroy
|
|
|
|
}.each do |action|
|
|
|
|
test(action) { @key.respond_to? action }
|
|
|
|
end
|
|
|
|
end
|
2013-07-12 10:22:08 -04:00
|
|
|
|
2013-03-25 17:43:23 -04:00
|
|
|
tests('have attributes') do
|
2013-07-11 23:48:11 -04:00
|
|
|
attributes = [
|
2013-03-25 17:43:23 -04:00
|
|
|
:id,
|
|
|
|
:name,
|
|
|
|
:ssh_pub_key
|
|
|
|
]
|
2013-07-12 10:22:08 -04:00
|
|
|
|
2013-03-25 17:43:23 -04:00
|
|
|
tests("The key model should respond to") do
|
|
|
|
attributes.each do |attribute|
|
|
|
|
test("#{attribute}") { @key.respond_to? attribute }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2013-07-12 10:22:08 -04:00
|
|
|
|
2013-03-25 17:43:23 -04:00
|
|
|
test('#destroy') do
|
|
|
|
@key.destroy
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|