marionetta 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/marionetta/group.rb +3 -3
- data/lib/marionetta.rb +1 -1
- data/spec/marionetta_group_spec.rb +17 -0
- metadata +1 -1
data/lib/marionetta/group.rb
CHANGED
@@ -24,9 +24,9 @@ module Marionetta
|
|
24
24
|
return groups
|
25
25
|
end
|
26
26
|
|
27
|
-
def add_server()
|
28
|
-
server
|
29
|
-
yield server
|
27
|
+
def add_server(server = nil)
|
28
|
+
server ||= Marionetta.default_server
|
29
|
+
yield server if block_given?
|
30
30
|
@servers << server
|
31
31
|
end
|
32
32
|
|
data/lib/marionetta.rb
CHANGED
@@ -4,6 +4,12 @@ require 'marionetta/group'
|
|
4
4
|
describe Marionetta::Group do
|
5
5
|
it 'should add server map' do
|
6
6
|
vagrant = Marionetta::Group.new
|
7
|
+
vagrant.add_server({:hostname => 'localhost'})
|
8
|
+
vagrant.servers.count.should == 1
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should add server map from block' do
|
12
|
+
vagrant = Marionetta::Group.new
|
7
13
|
|
8
14
|
vagrant.add_server do |s|
|
9
15
|
s[:hostname] = 'vagrant@192.168.33.11'
|
@@ -13,6 +19,17 @@ describe Marionetta::Group do
|
|
13
19
|
vagrant.servers.count.should == 1
|
14
20
|
end
|
15
21
|
|
22
|
+
it 'should extend provided map when block also given' do
|
23
|
+
vagrant = Marionetta::Group.new
|
24
|
+
|
25
|
+
vagrant.add_server(:hostname => 'localhost') do |s|
|
26
|
+
s[:additional] = true
|
27
|
+
end
|
28
|
+
|
29
|
+
vagrant.servers.first.has_key?(:hostname).should == true
|
30
|
+
vagrant.servers.first.has_key?(:additional).should == true
|
31
|
+
end
|
32
|
+
|
16
33
|
it 'should add sub groups' do
|
17
34
|
staging = Marionetta::Group.new
|
18
35
|
|