1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

fixing misc recently introduced spec/test bugs

This commit is contained in:
geemus 2010-11-16 15:31:34 -08:00
parent 8b30d74366
commit b1473b39f5
28 changed files with 51 additions and 43 deletions

View file

@ -26,7 +26,7 @@ GEM
rake (0.8.7)
rspec (1.3.1)
ruby-hmac (0.4.0)
shindo (0.1.8)
shindo (0.1.9)
formatador (>= 0.0.14)
gestalt (>= 0.0.11)
@ -45,4 +45,4 @@ DEPENDENCIES
rake
rspec (= 1.3.1)
ruby-hmac
shindo (= 0.1.8)
shindo (= 0.1.9)

View file

@ -55,7 +55,7 @@ Gem::Specification.new do |s|
## those that are only needed during development
s.add_development_dependency('rake')
s.add_development_dependency('rspec', '1.3.1')
s.add_development_dependency('shindo', '0.1.8')
s.add_development_dependency('shindo', '0.1.9')
## Leave this section as-is. It will be automatically generated from the
## contents of your Git repository via the gemspec task. DO NOT REMOVE

View file

@ -136,9 +136,12 @@ module Fog
raise ArgumentError, "Missing required arguments: #{missing.join(', ')}"
end
unrecognized = options.keys - requirements - recognized
unless unrecognized.empty?
raise ArgumentError, "Unrecognized arguments: #{unrecognized.join(', ')}"
# FIXME: avoid failing for the services that don't have recognizes yet
unless recognizes.empty?
unrecognized = options.keys - requirements - recognized
unless unrecognized.empty?
raise ArgumentError, "Unrecognized arguments: #{unrecognized.join(', ')}"
end
end
end

View file

@ -85,7 +85,6 @@ module Fog
'Contents' => truncated_contents,
'IsTruncated' => truncated_contents.size != contents.size,
'Marker' => options['marker'],
'MaxKeys' => max_keys,
'Name' => bucket['Name'],
'Prefix' => options['prefix']
}

View file

@ -1,5 +1,4 @@
require File.dirname(__FILE__) + '/../../../spec_helper'
require File.dirname(__FILE__) + '/../../../shared_examples/server_examples'
describe 'Fog::AWS::Compute::Server' do

View file

@ -1,5 +1,5 @@
Shindo.tests('Bluebox::Compute | flavors collection', ['bluebox']) do
flavors_tests(Bluebox[:compute])
flavors_tests(Bluebox[:compute], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Bluebox::Compute | server model', ['bluebox']) do
server_tests(Bluebox[:compute], {:image_id => 'a00baa8f-b5d0-4815-8238-b471c4c4bf72'})
server_tests(Bluebox[:compute], {:image_id => 'a00baa8f-b5d0-4815-8238-b471c4c4bf72'}, false)
end

View file

@ -1,6 +1,6 @@
Shindo.tests('Bluebox::Compute | servers collection', ['bluebox']) do
# Ubuntu 9.10 64bit
servers_tests(Bluebox[:compute], {:image_id => 'a00baa8f-b5d0-4815-8238-b471c4c4bf72'})
servers_tests(Bluebox[:compute], {:image_id => 'a00baa8f-b5d0-4815-8238-b471c4c4bf72'}, false)
end

View file

@ -1,4 +1,4 @@
def collection_tests(collection, params, mocks_implemented = true)
def collection_tests(collection, params = {}, mocks_implemented = true)
tests('success') do
@ -38,7 +38,7 @@ def collection_tests(collection, params, mocks_implemented = true)
tests('failure') do
if !Fog.mocking? || mocks_implemented
@identity = @identity.gsub(/\w/, '0')
@identity = @identity.to_s.gsub(/\w/, '0')
end
tests("#get('#{@identity}')").returns(nil) do

View file

@ -21,7 +21,7 @@ def flavors_tests(connection, params = {}, mocks_implemented = true)
tests('failure') do
if !Fog.mocking? || mocks_implemented
invalid_flavor_identity = connection.flavors.first.identity.gsub(/\w/, '0')
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0')
end
tests("#get('#{invalid_flavor_identity}')").returns(nil) do

View file

@ -1,4 +1,4 @@
def servers_tests(connection, params, mocks_implemented = true)
def servers_tests(connection, params = {}, mocks_implemented = true)
collection_tests(connection.servers, params, mocks_implemented) do

View file

@ -1,4 +1,4 @@
def model_tests(collection, params, mocks_implemented = true)
def model_tests(collection, params = {}, mocks_implemented = true)
tests('success') do

View file

@ -1,4 +1,6 @@
def directories_tests(connection, params = {:key => 'fogdirectoriestests'}, mocks_implemented = true)
def directories_tests(connection, params = {}, mocks_implemented = true)
params = {:key => 'fogdirectoriestests'}.merge!(params)
collection_tests(connection.directories, params, mocks_implemented)

View file

@ -1,12 +1,17 @@
def directory_tests(connection, params = {:key => 'fogdirectorytests'}, mocks_implemented = true)
def directory_tests(connection, params = {}, mocks_implemented = true)
params = {:key => 'fogdirectorytests'}.merge!(params)
model_tests(connection.directories, params, mocks_implemented) do
tests("#public=(true)").succeeds do
pending if Fog.mocking? && !mocks_implemented
@instance.public=(true)
end
responds_to(:public_url)
if !Fog.mocking? || mocks_implemented
responds_to(:public_url)
end
end

View file

@ -1,18 +1,18 @@
def file_tests(connection, params = {:key => 'fog_file_tests', :body => lorem_file}, mocks_implemented = true)
def file_tests(connection, params = {}, mocks_implemented = true)
params = {:key => 'fog_file_tests', :body => lorem_file}.merge!(params)
if !Fog.mocking? || mocks_implemented
@directory = connection.directories.create(:key => 'fogfilestests')
end
model_tests(@directory.files, params, mocks_implemented) do
model_tests(@directory.files, params, mocks_implemented) do
tests("#respond_to?(:public_url)").succeeds do
@instance.respond_to?(:public_url)
end
tests("#respond_to?(:public_url)").succeeds do
@instance.respond_to?(:public_url)
end
end
if !Fog.mocking? || mocks_implemented
@directory.destroy
end

View file

@ -1,12 +1,12 @@
def files_tests(connection, params = {:key => 'fog_files_tests', :body => lorem_file}, mocks_implemented = true)
def files_tests(connection, params = {}, mocks_implemented = true)
params = {:key => 'fog_files_tests', :body => lorem_file}.merge!(params)
if !Fog.mocking? || mocks_implemented
@directory = connection.directories.create(:key => 'fogfilestests')
end
collection_tests(@directory.files, params, mocks_implemented)
collection_tests(@directory.files, params, mocks_implemented)
if !Fog.mocking? || mocks_implemented
@directory.destroy
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Local::Storage | directories collection', ['local']) do
directories_tests(Local[:storage], false)
directories_tests(Local[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Local::Storage | directory model', ['local']) do
directory_tests(Local[:storage], false)
directory_tests(Local[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Local::Storage | file model', ['local']) do
file_tests(Local[:storage], false)
file_tests(Local[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Local::Storage | files collection', ['local']) do
files_tests(Local[:storage], false)
files_tests(Local[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Rackspace::Compute | flavors collection', ['rackspace']) do
flavors_tests(Rackspace[:compute])
flavors_tests(Rackspace[:compute], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Rackspace::Storage | directories collection', ['rackspace']) do
directories_tests(Rackspace[:storage], false)
directories_tests(Rackspace[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Rackspace::Storage | directory model', ['rackspace']) do
directory_tests(Rackspace[:storage], false)
directory_tests(Rackspace[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Rackspace::Storage | file model', ['rackspace']) do
file_tests(Rackspace[:storage], false)
file_tests(Rackspace[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Rackspace::Storage | files collection', ['rackspace']) do
files_tests(Rackspace[:storage], false)
files_tests(Rackspace[:storage], {}, false)
end

View file

@ -1,5 +1,5 @@
Shindo.tests('Slicehost::Compute | flavors collection', ['slicehost']) do
flavors_tests(Slicehost[:compute])
flavors_tests(Slicehost[:compute], {}, false)
end

View file

@ -1,6 +1,6 @@
Shindo.tests('Slicehost::Compute | server model', ['slicehost']) do
# image 49 = Ubuntu 10.04 LTS (lucid)
server_tests(Slicehost[:compute], {:image_id => 49, :name => "fog_#{Time.now.to_i}")
server_tests(Slicehost[:compute], {:image_id => 49, :name => "fog_#{Time.now.to_i}"}, false)
end

View file

@ -1,6 +1,6 @@
Shindo.tests('Slicehost::Compute | servers collection', ['slicehost']) do
# image 49 = Ubuntu 10.04 LTS (lucid)
servers_tests(Slicehost[:compute], {:image_id => 49, :name => "fog_#{Time.now.to_i}"})
servers_tests(Slicehost[:compute], {:image_id => 49, :name => "fog_#{Time.now.to_i}"}, false)
end