Sha256: 5ae41cbfd988cb05d4d68bd79978be18f3d44eb984f7d84bfd4426fa12d7caf7

Contents?: true

Size: 783 Bytes

Versions: 36

Compression:

Stored size: 783 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(@instance)
    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(65_536).to_s(16).rjust(4, "0")
  [base_name, suffix].join("-")
end

Version data entries

36 entries across 34 versions & 3 rubygems

Version Path
fog-brightbox-1.10.0 tests/helpers/model_helper.rb
fog-brightbox-1.9.1 tests/helpers/model_helper.rb
fog-brightbox-1.9.0 tests/helpers/model_helper.rb
fog-brightbox-1.8.2 tests/helpers/model_helper.rb
fog-brightbox-1.8.1 tests/helpers/model_helper.rb
fog-brightbox-1.8.0 tests/helpers/model_helper.rb
fog-brightbox-1.7.3 tests/helpers/model_helper.rb
fog-brightbox-1.7.2 tests/helpers/model_helper.rb
fog-brightbox-1.7.1 tests/helpers/model_helper.rb
fog-brightbox-1.7.0 tests/helpers/model_helper.rb
fog-brightbox-1.6.0 tests/helpers/model_helper.rb
fog-brightbox-1.5.0 tests/helpers/model_helper.rb
fog-brightbox-1.5.0.rc1 tests/helpers/model_helper.rb
fog-brightbox-1.4.2 tests/helpers/model_helper.rb
fog-brightbox-1.4.1 tests/helpers/model_helper.rb
fog-brightbox-1.4.0 tests/helpers/model_helper.rb
fog-brightbox-1.3.0 tests/helpers/model_helper.rb
fog-brightbox-1.2.0 tests/helpers/model_helper.rb
fog-brightbox-1.1.0 tests/helpers/model_helper.rb
fog-brightbox-1.0.0 tests/helpers/model_helper.rb