Sha256: 45c85b90797efc1e7fbcd07d4789ecc62b79d7f44641ba406441c39d76b64aec
Contents?: true
Size: 1.37 KB
Versions: 23
Compression:
Stored size: 1.37 KB
Contents
require "helpers/test_helper" class UnitTestDNSCollections < MiniTest::Test def setup Fog.mock! @client = Fog::DNS.new(provider: "google", google_project: "foo") # Exceptions that do not pass test_common_methods: # # DNS Projects API does not support 'list', so 'all' method is not possible @common_methods_exceptions = [Fog::DNS::Google::Projects] # Enumerate all descendants of Fog::Collection descendants = ObjectSpace.each_object(Fog::Collection.singleton_class) @collections = descendants.select { |d| d.name.match(/Fog::DNS::Google/) } end def teardown Fog.unmock! end # This tests whether Fog::Compute::Google collections have common lifecycle methods def test_common_methods subjects = @collections - @common_methods_exceptions subjects.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 # TODO: Fixture for #352 skip @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
Version | Path |
---|---|
fog-google-1.8.2 | test/unit/dns/test_common_collections.rb |
fog-google-1.8.1 | test/unit/dns/test_common_collections.rb |
fog-google-1.8.0 | test/unit/dns/test_common_collections.rb |