Sha256: cfe31890b51ce3d665c8d757e691939267db4e08777c0faca79cf54b04d85956
Contents?: true
Size: 1.05 KB
Versions: 23
Compression:
Stored size: 1.05 KB
Contents
require "helpers/test_helper" class UnitTestPubsubCollections < MiniTest::Test def setup Fog.mock! @client = Fog::Google::Pubsub.new(google_project: "foo") # Enumerate all descendants of Fog::Collection descendants = ObjectSpace.each_object(Fog::Collection.singleton_class) @collections = descendants.select { |d| d.name.match(/Fog::Google::Pubsub/) } end def teardown Fog.unmock! end def test_common_methods # This tests whether Fog::Compute::Google collections have common lifecycle methods @collections.each do |klass| obj = klass.new assert obj.respond_to?(:all), "#{klass} should have an .all method" assert obj.respond_to?(:get), "#{klass} should have a .get method" assert obj.respond_to?(:each), "#{klass} should behave like Enumerable" end end def test_collection_get_arguments @collections.each do |klass| obj = klass.new assert_operator(obj.method(:get).arity, :<=, 1, "#{klass} should have at most 1 required parameter in get()") end end end
Version data entries
23 entries across 23 versions & 2 rubygems