1
0
Fork 0
mirror of https://github.com/fog/fog-aws.git synced 2022-11-09 13:50:52 -05:00
fog--fog-aws/tests/helpers/compute/flavors_helper.rb
David Bishop 62256219f4 Modernize various tests to Ruby 2.x syntax
Also fix up various things that rubocop called out, though not
everything. Mostly whitespace fixes, changing double-quotes to single if
double wasn't required, changing to use ruby 2.x hash syntax where
possible, etc. While tests don't run, they are no more broken than
before (at least, as far as I can tell).
2018-10-16 16:12:42 -06:00

28 lines
815 B
Ruby

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
if !Fog.mocking? || mocks_implemented
@identity = connection.flavors.first.identity
end
tests("#get('#{@identity}')").succeeds do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.get(@identity)
end
end
tests('failure') do
if !Fog.mocking? || mocks_implemented
invalid_flavor_identity = connection.flavors.first.identity.to_s.gsub(/\w/, '0')
end
tests("#get('#{invalid_flavor_identity}')").returns(nil) do
pending if Fog.mocking? && !mocks_implemented
connection.flavors.get(invalid_flavor_identity)
end
end
end