Class: Serverspec::Type::RabbitmqBase

Inherits:
ApiBase
  • Object
show all
Defined in:
lib/serverspec_extra_types/types/rabbitmq_base.rb

Instance Method Summary collapse

Methods inherited from ApiBase

#[], #url

Constructor Details

#initialize(name = nil, options = {}) ⇒ RabbitmqBase

Returns a new instance of RabbitmqBase.



11
12
13
14
15
16
# File 'lib/serverspec_extra_types/types/rabbitmq_base.rb', line 11

def initialize(name = nil, options = {})
  super(name, options)
  @user = ENV['RABBITMQ_USER'] || 'guest'
  @password = ENV['RABBITMQ_PASSWORD'] || 'guest'
  @url_base = property[:variables][:rabbitmq_url] || 'http://localhost:15672'
end

Instance Method Details

#inspectionObject



18
19
20
# File 'lib/serverspec_extra_types/types/rabbitmq_base.rb', line 18

def inspection
  @inspection ||= ::MultiJson.load(get_inspection.stdout)[0]
end

#lengthObject



22
23
24
25
26
27
28
29
30
# File 'lib/serverspec_extra_types/types/rabbitmq_base.rb', line 22

def length
  if inspection.is_a? String
    inspection.length
  elsif inspection.is_a? Array
    inspection.length
  else
    1
  end
end