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.



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

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



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

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

#lengthObject



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

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