Sha256: a4d999f475b9f4e4f61e7703a3c21c95a2cab2000b481916f2baaf9dc284652d

Contents?: true

Size: 857 Bytes

Versions: 18

Compression:

Stored size: 857 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 { [] }
  created_at { Time.now }

  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

18 entries across 18 versions & 1 rubygems

Version Path
aptible-cli-0.24.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.24.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.24.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.23.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.22.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.21.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.20.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.9 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.7 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.6 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.4 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.3 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.19.0 spec/fabricators/service_fabricator.rb
aptible-cli-0.18.3 spec/fabricators/service_fabricator.rb
aptible-cli-0.18.2 spec/fabricators/service_fabricator.rb
aptible-cli-0.18.1 spec/fabricators/service_fabricator.rb