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

35 lines
821 B
Ruby
Raw Normal View History

2010-11-12 02:01:18 -05:00
def flavors_tests(connection, params = {}, mocks_implemented = true)
tests('success') do
tests("#all").succeeds do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.all
end
2010-11-16 14:47:05 -05:00
if !Fog.mocking? || mocks_implemented
@identity = connection.flavors.first.identity
end
2010-11-12 02:01:18 -05:00
tests("#get('#{@identity}')").succeeds do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.get(@identity)
end
end
tests('failure') do
2010-11-16 14:47:05 -05:00
if !Fog.mocking? || mocks_implemented
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0')
2010-11-16 14:47:05 -05:00
end
2010-11-12 02:01:18 -05:00
tests("#get('#{invalid_flavor_identity}')").returns(nil) do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.get(invalid_flavor_identity)
end
end
end