Sha256: 434e3215c9d719b22a75aa6aabc34dce54e92aa17f33660e219e64a8b1f983d2

Contents?: true

Size: 831 Bytes

Versions: 17

Compression:

Stored size: 831 Bytes

Contents

class StubService < OpenStruct
  def each_vhost(&block)
    return enum_for(:each_vhost) if block.nil?
    vhosts.each(&block)
  end
end

Fabricator(:service, from: :stub_service) do
  transient :app, :database

  id { Fabricate.sequence(:service_id) { |i| i } }
  process_type 'web'
  command { nil }
  container_count { 1 }
  container_memory_limit_mb { 512 }
  vhosts { [] }

  after_create do |service, transients|
    if transients[:app]
      service.app = transients[:app]
    elsif transients[:database]
      service.database = transients[:database]
    else
      service.app = Fabricate(:app)
    end

    if service.app
      service.app.services << service
      service.account = service.app.account
    else
      service.database.service = service
      service.account = service.database.account
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aptible-cli-0.18.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.17.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.17.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.17.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.9 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.8 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.7 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.6 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.5 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.4 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.3 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.16.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.15.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.15.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.15.0 spec/fabricators/service_fabricator.rb