Sha256: b0d0cd23aa7d79f61d70f7770f56c18ed37bb522db7becd32f2e50baf66c4ed3

Contents?: true

Size: 702 Bytes

Versions: 2

Compression:

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

  process_type 'web'
  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

2 entries across 2 versions & 1 rubygems

Version Path
aptible-cli-0.14.1 spec/fabricators/service_fabricator.rb
aptible-cli-0.14.0 spec/fabricators/service_fabricator.rb