Sha256: 59ad66e6a98de3d253229f15221fed3a5815e0d38eed39a5d1a891144a281243

Contents?: true

Size: 861 Bytes

Versions: 19

Compression:

Stored size: 861 Bytes

Contents

# TODO: REMOVE this testing functionality is now covered in `spec/helpers/model_helper.rb`

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

    yield(@instance) if block_given?

    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

19 entries across 17 versions & 3 rubygems

Version Path
fog-internet-archive-0.0.2 tests/helpers/model_helper.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-internet-archive-0.0.1/tests/helpers/model_helper.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-internet-archive-0.0.1/tests/helpers/model_helper.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-internet-archive-0.0.1/tests/helpers/model_helper.rb
fog-google-0.6.0 tests/helpers/model_helper.rb
fog-google-0.5.5 tests/helpers/model_helper.rb
fog-google-0.5.4 tests/helpers/model_helper.rb
fog-google-0.5.3 tests/helpers/model_helper.rb
fog-internet-archive-0.0.1 tests/helpers/model_helper.rb
fog-google-0.5.2 tests/helpers/model_helper.rb
fog-google-0.5.1 tests/helpers/model_helper.rb
fog-google-0.5.0 tests/helpers/model_helper.rb
fog-google-0.4.2 tests/helpers/model_helper.rb
fog-google-0.4.1 tests/helpers/model_helper.rb
fog-google-0.4.0 tests/helpers/model_helper.rb
fog-google-0.3.2 tests/helpers/model_helper.rb
fog-google-0.3.1 tests/helpers/model_helper.rb
fog-google-0.3.0 tests/helpers/model_helper.rb
fog-google-0.2.0 tests/helpers/model_helper.rb