Module: RSpec::Core::DSL

Defined in:
lib/rspec/infrastructure/dsl.rb

Instance Method Summary collapse

Instance Method Details

#environment(*args, &block) ⇒ Object



10
11
12
13
14
# File 'lib/rspec/infrastructure/dsl.rb', line 10

def environment(*args, &block)
  *args = [ 'asdasd Shrubbery', { :environment => :shrubbery }]
  env = RSpec::Core::ExampleGroup.describe(*args, &block)
  env.register
end

#roles(roles, &block) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rspec/infrastructure/dsl.rb', line 16

def roles(roles, &block)
  roles.each do |role|
    Nagios::HostManager.hostnames_for_roles([:environment], role).each do |hostname|
      *args = [ "Host: #{hostname}", { :host => hostname }]
      bleh = RSpec::Core::ExampleGroup.describe(*args, &block)
      bleh.before :all do
        @host_manager = Nagios::HostManager.new
      end
      bleh.after :all do
        @host_manager.hosts.each { |hostname, host| host.ssh.close }
      end
      bleh.before do
        @host = @host_manager.manage(hostname)
      end
      bleh.register
    end
  end
end