Class: Skewer::StubNode

Inherits:
Object
  • Object
show all
Defined in:
lib/stub_node.rb

Overview

test stub for pretending to be a real node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeStubNode

Returns a new instance of StubNode.



6
7
8
9
10
11
# File 'lib/stub_node.rb', line 6

def initialize
  @dns_name = 'com.doodoo'
  @public_ip_address = '192.168.0.1'
  @username = 'imabirdbrain'
  @debug = false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



18
19
20
21
22
23
# File 'lib/stub_node.rb', line 18

def method_missing(name, *args)
  require 'ersatz/ssh_result.rb'
  Skewer.logger.debug "#{self.class}.#{name} called with #{args.join(',')}" if @debug
  return announce([ErsatzSSHResult.new('foo', 'success', 0)]) if name == :ssh
  announce true
end

Instance Attribute Details

#dns_nameObject (readonly)

Returns the value of attribute dns_name.



4
5
6
# File 'lib/stub_node.rb', line 4

def dns_name
  @dns_name
end

#public_ip_addressObject (readonly)

Returns the value of attribute public_ip_address.



4
5
6
# File 'lib/stub_node.rb', line 4

def public_ip_address
  @public_ip_address
end

#usernameObject (readonly)

Returns the value of attribute username.



4
5
6
# File 'lib/stub_node.rb', line 4

def username
  @username
end

Instance Method Details

#announce(return_type) ⇒ Object



13
14
15
16
# File 'lib/stub_node.rb', line 13

def announce(return_type)
  Skewer.logger.debug "#{self.class} will return #{return_type}" if @debug
  return_type
end