Sha256: 58233101bd32b6072ae5b3595489690ca713255324d1ca52d46e572b0258011e

Contents?: true

Size: 773 Bytes

Versions: 87

Compression:

Stored size: 773 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

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

87 entries across 87 versions & 12 rubygems

Version Path
fog-core-1.24.0 lib/fog/test_helpers/model_helper.rb
fog-core-1.23.0 lib/fog/test_helpers/model_helper.rb
fog-softlayer-0.2.1 tests/helpers/model_helper.rb
fog-softlayer-0.1.1 tests/helpers/model_helper.rb
fog-softlayer-0.1.0 tests/helpers/model_helper.rb
fog-softlayer-0.0.9 tests/helpers/model_helper.rb
fog-softlayer-0.0.8 tests/helpers/model_helper.rb
fog-softlayer-0.0.7 tests/helpers/model_helper.rb
fog-softlayer-0.0.5 tests/helpers/model_helper.rb
fog-1.22.0 tests/helpers/model_helper.rb
fog-core-1.22.0 lib/fog/test_helpers/model_helper.rb
fog-1.21.0 tests/helpers/model_helper.rb
fog-core-1.21.1 lib/fog/test_helpers/model_helper.rb
fog-maestrodev-1.20.0.20140305101839 tests/helpers/model_helper.rb
fog-maestrodev-1.20.0.20140305101305 tests/helpers/model_helper.rb
fog-core-1.21.0 lib/fog/test_helpers/model_helper.rb
fog-maestrodev-1.19.0.20140212012611 tests/helpers/model_helper.rb
fog-1.20.0 tests/helpers/model_helper.rb
fog-maestrodev-1.19.0.20140110004459 tests/helpers/model_helper.rb
fog-maestrodev-1.19.0.20140110003812 tests/helpers/model_helper.rb