tests/helpers/collection_helper.rb in fog-brightbox-1.10.0 vs tests/helpers/collection_helper.rb in fog-brightbox-1.11.0

- old
+ new

@@ -18,13 +18,11 @@ tests("#all").succeeds do pending if Fog.mocking? && !mocks_implemented collection.all end - if !Fog.mocking? || mocks_implemented - @identity = @instance.identity - end + @identity = @instance.identity if !Fog.mocking? || mocks_implemented tests("#get(#{@identity})").succeeds do pending if Fog.mocking? && !mocks_implemented collection.get(@identity) end @@ -43,37 +41,32 @@ if RUBY_PLATFORM == "java" && JRUBY_VERSION =~ /1\.7\.[5-8]/ methods.delete("all?") end methods.each do |enum_method| - if collection.respond_to?(enum_method) - tests("##{enum_method}").succeeds do - block_called = false - collection.send(enum_method) { |_x| block_called = true } - block_called - end + next unless collection.respond_to?(enum_method) + tests("##{enum_method}").succeeds do + block_called = false + collection.send(enum_method) { |_x| block_called = true } + block_called end end - %w( - max_by min_by).each do |enum_method| - if collection.respond_to?(enum_method) - tests("##{enum_method}").succeeds do - block_called = false - collection.send(enum_method) { |_x| block_called = true; 0 } - block_called - end + %w[ + max_by min_by + ].each do |enum_method| + next unless collection.respond_to?(enum_method) + tests("##{enum_method}").succeeds do + block_called = false + collection.send(enum_method) { |_x| block_called = true; 0 } + block_called end end end - if block_given? - yield(@instance) - end + yield(@instance) if block_given? - if !Fog.mocking? || mocks_implemented - @instance.destroy - end + @instance.destroy if !Fog.mocking? || mocks_implemented end tests("failure") do if !Fog.mocking? || mocks_implemented @identity = @identity.to_s