Sha256: 0db862b97ad522f003e8489dda355bf3bab04f01a1d7aaad662fee359b6f2dd9

Contents?: true

Size: 802 Bytes

Versions: 35

Compression:

Stored size: 802 Bytes

Contents

def model_tests(collection, params = {}, mocks_implemented = true)

  tests('success') do

    @instance = collection.new(params)

    tests("#save").succeeds do
      pending if Fog.mocking? && !mocks_implemented
      @instance.save
    end

    if block_given?
      yield
    end

    tests("#destroy").succeeds do
      pending if Fog.mocking? && !mocks_implemented
      @instance.destroy
    end

  end

  tests('failure') do
  end

end

# Generates a unique identifier with a random differentiator.
# Useful when rapidly re-running tests, so we don't have to wait
# serveral minutes for deleted objects to disappear from the API
# E.g. 'fog-test-1234'
def uniq_id(base_name = 'fog-test')
  # random_differentiator
  suffix = rand(65536).to_s(16).rjust(4, '0')
  [base_name, suffix] * '-'
end


Version data entries

35 entries across 35 versions & 9 rubygems

Version Path
fog-1.5.0 tests/helpers/model_helper.rb
rackspace-fog-1.4.2 tests/helpers/model_helper.rb
fog-1.4.0 tests/helpers/model_helper.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
michiels-fog-1.3.1 tests/helpers/model_helper.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/helpers/model_helper.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
fog-1.3.1 tests/helpers/model_helper.rb
fog-1.3.0 tests/helpers/model_helper.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
fog-1.2.0 tests/helpers/model_helper.rb
ktheory-fog-1.1.2 tests/helpers/model_helper.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/tests/helpers/model_helper.rb
fog-1.1.2 tests/helpers/model_helper.rb
fog_tractical-1.1.4 tests/helpers/model_helper.rb
fog_tractical-1.1.3 tests/helpers/model_helper.rb