auser-poolparty 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. data/Manifest.txt +201 -0
  2. data/PostInstall.txt +17 -0
  3. data/Rakefile +22 -1
  4. data/bin/cloud-add-keypair +0 -0
  5. data/bin/cloud-osxcopy +22 -0
  6. data/bin/cloud-provision +1 -0
  7. data/bin/cloud-start +17 -15
  8. data/bin/cloud-terminate +23 -0
  9. data/bin/pool-start +14 -14
  10. data/bin/pool-start-monitor +1 -0
  11. data/config/hoe.rb +114 -0
  12. data/config/requirements.rb +15 -0
  13. data/lib/poolparty.rb +1 -0
  14. data/lib/poolparty/base_packages/haproxy.rb +32 -31
  15. data/lib/poolparty/base_packages/heartbeat.rb +2 -2
  16. data/lib/poolparty/base_packages/poolparty.rb +9 -3
  17. data/lib/poolparty/base_packages/ruby.rb +10 -0
  18. data/lib/poolparty/core/proc.rb +5 -0
  19. data/lib/poolparty/core/string.rb +1 -1
  20. data/lib/poolparty/helpers/binary.rb +6 -5
  21. data/lib/poolparty/helpers/display.rb +11 -2
  22. data/lib/poolparty/helpers/optioner.rb +6 -3
  23. data/lib/poolparty/helpers/provisioner_base.rb +9 -7
  24. data/lib/poolparty/helpers/provisioners/master.rb +38 -4
  25. data/lib/poolparty/helpers/provisioners/slave.rb +2 -2
  26. data/lib/poolparty/modules/cloud_resourcer.rb +20 -3
  27. data/lib/poolparty/modules/definable_resource.rb +1 -1
  28. data/lib/poolparty/modules/method_missing_sugar.rb +12 -4
  29. data/lib/poolparty/modules/pretty_printer.rb +2 -1
  30. data/lib/poolparty/net/remote.rb +1 -1
  31. data/lib/poolparty/net/remote_bases/ec2.rb +13 -10
  32. data/lib/poolparty/net/remote_instance.rb +3 -2
  33. data/lib/poolparty/net/remoter.rb +33 -18
  34. data/lib/poolparty/net/remoter_base.rb +3 -3
  35. data/lib/poolparty/plugins/gem_package.rb +6 -29
  36. data/lib/poolparty/plugins/git.rb +22 -0
  37. data/lib/poolparty/pool/base.rb +7 -6
  38. data/lib/poolparty/pool/cloud.rb +34 -5
  39. data/lib/poolparty/pool/custom_resource.rb +4 -4
  40. data/lib/poolparty/pool/plugin.rb +13 -14
  41. data/lib/poolparty/pool/resource.rb +19 -10
  42. data/lib/poolparty/pool/resources/class_package.rb +10 -6
  43. data/lib/poolparty/pool/resources/conditional.rb +41 -0
  44. data/lib/poolparty/pool/resources/gem.rb +2 -2
  45. data/lib/poolparty/pool/script.rb +25 -2
  46. data/lib/poolparty/templates/haproxy.conf +1 -1
  47. data/lib/poolparty/templates/puppet.conf +4 -2
  48. data/lib/poolparty/version.rb +1 -1
  49. data/poolparty.gemspec +60 -0
  50. data/setup.rb +1585 -0
  51. data/spec/poolparty/base_packages/haproxy_spec.rb +13 -0
  52. data/spec/poolparty/base_packages/heartbeat_spec.rb +30 -0
  53. data/spec/poolparty/bin/console_spec.rb +80 -0
  54. data/spec/poolparty/core/array_spec.rb +26 -0
  55. data/spec/poolparty/core/float.rb +13 -0
  56. data/spec/poolparty/core/hash_spec.rb +63 -0
  57. data/spec/poolparty/core/kernel_spec.rb +24 -0
  58. data/spec/poolparty/core/module_spec.rb +15 -0
  59. data/spec/poolparty/core/object_spec.rb +40 -0
  60. data/spec/poolparty/core/string_spec.rb +152 -0
  61. data/spec/poolparty/core/time_spec.rb +52 -0
  62. data/spec/poolparty/helpers/binary_spec.rb +26 -0
  63. data/spec/poolparty/helpers/display_spec.rb +13 -0
  64. data/spec/poolparty/helpers/optioner_spec.rb +39 -0
  65. data/spec/poolparty/helpers/provisioner_base_spec.rb +121 -0
  66. data/spec/poolparty/helpers/provisioners/master_spec.rb +54 -0
  67. data/spec/poolparty/helpers/provisioners/slave_spec.rb +28 -0
  68. data/spec/poolparty/modules/cloud_resourcer_spec.rb +135 -0
  69. data/spec/poolparty/modules/configurable_spec.rb +26 -0
  70. data/spec/poolparty/modules/definable_resource.rb +9 -0
  71. data/spec/poolparty/modules/file_writer_spec.rb +49 -0
  72. data/spec/poolparty/modules/s3_string_spec.rb +15 -0
  73. data/spec/poolparty/net/remote_bases/ec2_spec.rb +92 -0
  74. data/spec/poolparty/net/remote_instance_spec.rb +70 -0
  75. data/spec/poolparty/net/remote_spec.rb +286 -0
  76. data/spec/poolparty/net/remoter_base_spec.rb +80 -0
  77. data/spec/poolparty/net/remoter_spec.rb +191 -0
  78. data/spec/poolparty/plugins/git_spec.rb +19 -0
  79. data/spec/poolparty/plugins/line_spec.rb +16 -0
  80. data/spec/poolparty/plugins/svn_spec.rb +16 -0
  81. data/spec/poolparty/pool/base_spec.rb +108 -0
  82. data/spec/poolparty/pool/cloud_spec.rb +299 -0
  83. data/spec/poolparty/pool/configurers/files/ruby_basic.rb +17 -0
  84. data/spec/poolparty/pool/configurers/files/ruby_plugins.rb +16 -0
  85. data/spec/poolparty/pool/configurers/ruby_spec.rb +58 -0
  86. data/spec/poolparty/pool/custom_resource_spec.rb +115 -0
  87. data/spec/poolparty/pool/example_spec.rb +112 -0
  88. data/spec/poolparty/pool/plugin_model_spec.rb +63 -0
  89. data/spec/poolparty/pool/plugin_spec.rb +85 -0
  90. data/spec/poolparty/pool/pool_spec.rb +83 -0
  91. data/spec/poolparty/pool/resource_spec.rb +224 -0
  92. data/spec/poolparty/pool/resources/class_package_spec.rb +84 -0
  93. data/spec/poolparty/pool/resources/conditional_spec.rb +38 -0
  94. data/spec/poolparty/pool/resources/cron_spec.rb +49 -0
  95. data/spec/poolparty/pool/resources/directory_spec.rb +40 -0
  96. data/spec/poolparty/pool/resources/exec_spec.rb +37 -0
  97. data/spec/poolparty/pool/resources/file_spec.rb +40 -0
  98. data/spec/poolparty/pool/resources/gem_spec.rb +16 -0
  99. data/spec/poolparty/pool/resources/host_spec.rb +28 -0
  100. data/spec/poolparty/pool/resources/package_spec.rb +44 -0
  101. data/spec/poolparty/pool/resources/remote_file_spec.rb +40 -0
  102. data/spec/poolparty/pool/resources/service_spec.rb +45 -0
  103. data/spec/poolparty/pool/resources/sshkey_spec.rb +48 -0
  104. data/spec/poolparty/pool/resources/variable_spec.rb +20 -0
  105. data/spec/poolparty/pool/script_spec.rb +51 -0
  106. data/spec/poolparty/pool/test_plugins/sshkey_test +2 -0
  107. data/spec/poolparty/pool/test_plugins/virtual_host_template.erb +0 -0
  108. data/spec/poolparty/pool/test_plugins/webserver.rb +46 -0
  109. data/spec/poolparty/poolparty_spec.rb +33 -0
  110. data/spec/poolparty/spec_helper.rb +120 -0
  111. data/test/test_generator_helper.rb +29 -0
  112. data/test/test_helper.rb +2 -0
  113. data/test/test_pool_spec_generator.rb +47 -0
  114. data/test/test_poolparty.rb +11 -0
  115. data/website/index.html +81 -0
  116. data/website/index.txt +72 -0
  117. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  118. data/website/stylesheets/screen.css +138 -0
  119. data/website/template.html.erb +48 -0
  120. metadata +178 -60
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "haproxy base package" do
4
+ before(:each) do
5
+ @ha = PoolPartyHaproxyClass.new do
6
+ end
7
+ stub_list_from_remote_for(@ha)
8
+ @ha.stub!(:list_of_running_instances).and_return []
9
+ end
10
+ it "should have the heartbeat package defined" do
11
+ lambda {PoolPartyHaproxyClass}.should_not raise_error
12
+ end
13
+ end
@@ -0,0 +1,30 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "heartbeat base package" do
4
+ # before(:each) do
5
+ # @cloud = Cloud.new(:app, self)
6
+ # @hb = PoolPartyHeartbeatClass.new(@cloud)
7
+ # stub_list_from_remote_for(@cloud)
8
+ # stub_list_of_instances_for(@cloud)
9
+ # end
10
+ # it "should have the heartbeat package defined" do
11
+ # lambda {PoolPartyHeartbeatClass}.should_not raise_error
12
+ # end
13
+ # it "should have a parent set to the cloud" do
14
+ # @hb.parent.should == @cloud
15
+ # end
16
+ # it "should call enable (and setup resources) since there is no block given when it's instantiated" do
17
+ # @hb.resources.should_not be_empty
18
+ # end
19
+ # it "should have no resources when starting with a block (that defines no methods)" do
20
+ # @pphc = PoolPartyHeartbeatClass.new do
21
+ # end
22
+ # @pphc.resources.should be_empty
23
+ # end
24
+ # it "should have a file resource" do
25
+ # @hb.resource(:remotefile).should_not be_empty
26
+ # end
27
+ # it "should have at least 3 remotefiles" do
28
+ # @hb.resource(:remotefile).size.should >= 3
29
+ # end
30
+ end
@@ -0,0 +1,80 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+ require File.dirname(__FILE__) + '/../../../lib/poolparty/helpers/console'
3
+
4
+ describe "Console" do
5
+ before(:each) do
6
+ ::File.stub!(:file?).with("pop").and_return true
7
+ end
8
+ describe "load_pool" do
9
+ before(:each) do
10
+ reset!
11
+ @string =<<-EOS
12
+ pool :app do
13
+ maximum_instances 2
14
+ cloud :rawr do
15
+ end
16
+ end
17
+ EOS
18
+ self.stub!(:open).and_return @string
19
+ @string.stub!(:read).and_return @string
20
+ end
21
+ it "should give you the load_pool method" do
22
+ self.respond_to?(:load_pool).should == true
23
+ end
24
+ it "should call script inflate on the filename" do
25
+ PoolParty::Script.should_receive(:inflate).once
26
+ load_pool("pop")
27
+ end
28
+ describe "calling" do
29
+ before(:each) do
30
+ reset!
31
+ load_pool("pop")
32
+ end
33
+ it "should instance_eval the string" do
34
+ pool(:app).should_not be_nil
35
+ end
36
+ it "should store the cloud inside the pool after inflating" do
37
+ pool(:app).cloud(:rawr).should_not be_nil
38
+ end
39
+ it "should say that the cloud inside the pool's parent is the containing parent" do
40
+ pool(:app).cloud(:rawr).parent.should == pool(:app)
41
+ end
42
+ it "should say that the maximum_instances on the cloud is the containing pool's option" do
43
+ pool(:app).cloud(:rawr).maximum_instances.should == 2
44
+ end
45
+ end
46
+ end
47
+ describe "reload!" do
48
+ before(:each) do
49
+ reset!
50
+ self.stub!(:require).and_return true
51
+ end
52
+ it "should call reset!" do
53
+ self.should_receive(:reset!).once
54
+ end
55
+ after do
56
+ reload!
57
+ end
58
+ end
59
+ describe "print" do
60
+ before(:each) do
61
+ reset!
62
+ @string =<<-EOS
63
+ pool :app do
64
+ maximum_instances 2
65
+ cloud :rawr do
66
+ end
67
+ end
68
+ EOS
69
+ self.stub!(:open).and_return @string
70
+ @string.stub!(:read).and_return @string
71
+ load_pool("pop")
72
+ end
73
+ it "should be able to print the clouds" do
74
+ pools.should_not be_empty
75
+ hide_output do
76
+ pool_describe.should == pools.size
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,26 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Array" do
4
+ before(:each) do
5
+ @array = ["run this", "run that"]
6
+ end
7
+ describe "runnable" do
8
+ it "should be able to produced a runnable string" do;@array.runnable.should == 'run this && run that';end
9
+ it "should be turn into a string" do;@array.runnable.class.should == String;end
10
+ end
11
+ describe "nice_runnable" do
12
+ before(:each) do
13
+ @array << ""
14
+ @array << "peabody"
15
+ end
16
+ it "should reject any empty elements out of the array" do
17
+ (@array << [""]).nice_runnable.should == "run this \n run that \n peabody"
18
+ end
19
+ end
20
+ describe "to_os" do
21
+ it "should be able to turn itself to an open struct" do; @array.first.should_receive(:to_os);end
22
+ after do
23
+ @array.to_os
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,13 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Float" do
4
+ it "should be able to round to the nearest integer" do
5
+ 10.95.round_to(1).should == 11
6
+ end
7
+ it "should be able to get the ceiling" do
8
+ 10.54.ceil_to(1).should == 10.6
9
+ end
10
+ it "should be able to get the floor" do
11
+ 10.14.floor_to(1).should == 10.1
12
+ end
13
+ end
@@ -0,0 +1,63 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Hash" do
4
+ before(:each) do
5
+ @a = {:a => "10", :b => "20", :c => "30"}
6
+ end
7
+ it "should preserve the contents of the original hash when safe_merge'ing" do
8
+ a = {:a => "10", :b => "20"}
9
+ b = {:b => "30", :c => "40"}
10
+ a.safe_merge(b).should == {:a => "10", :b => "20", :c => "40"}
11
+ end
12
+ it "should preserve the contents of the original hash when safe_merge!'ing" do
13
+ a = {:a => "10", :b => "20"}
14
+ b = {:b => "30", :c => "40"}
15
+ a.safe_merge!(b)
16
+ a.should == {:a => "10", :b => "20", :c => "40"}
17
+ end
18
+ it "should be able to turn itself into an open struct" do
19
+ @a.to_os.class.should == MyOpenStruct
20
+ end
21
+ it "should respond to to_hash" do
22
+ @a.to_os.respond_to?(:to_hash).should == true
23
+ end
24
+ it "should be able to turn itself into an open struct with the method to_hash on the object" do
25
+ @a.to_os.to_hash.should == @a
26
+ end
27
+ it "should not put quotes around integers" do
28
+ {:a => 10, :b => "q"}.flush_out.should == ["a => 10", "b => 'q'"]
29
+ end
30
+ it "should be able to flush out into a string into an array" do
31
+ @a.flush_out.should == ["a => '10'","b => '20'","c => '30'"]
32
+ end
33
+ it "should be able to flush out with prev and posts" do
34
+ @a.flush_out("hi", "ho").should == ["hia => '10'ho","hib => '20'ho","hic => '30'ho"]
35
+ end
36
+ describe "select" do
37
+ before(:each) do
38
+ @selected_hash = @a.select {|k,v| k if k == :a}
39
+ end
40
+ it "should return a hash when selecting" do
41
+ @selected_hash.class.should == Hash
42
+ end
43
+ it "should only have the key a (selected)" do
44
+ @selected_hash.keys.should == [:a]
45
+ end
46
+ end
47
+ describe "extract!" do
48
+ before(:each) do
49
+ @rejected_hash = @a.extract! {|k,v| k == :a }
50
+ end
51
+ it "should have a reject with the keys" do
52
+ @rejected_hash.keys.should == [:a]
53
+ end
54
+ it "should return the old array with the other keys" do
55
+ @a.keys.should == [:b, :c]
56
+ end
57
+ it "should not throw a fit with an empty hash" do
58
+ lambda {
59
+ {}.extract!
60
+ }.should_not raise_error
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Kernel extensions" do
4
+ before(:each) do
5
+ @obj = Object.new
6
+ end
7
+ it "should eval the string into time" do
8
+ @obj.should_receive(:sleep).once.with(10.seconds).and_return true
9
+ @obj.wait "10.seconds"
10
+ end
11
+ end
12
+ describe "Object extensions" do
13
+ before(:each) do
14
+ @klass = Object.new
15
+ @klass.instance_eval <<-EOE
16
+ def hello
17
+ puts "hello"
18
+ end
19
+ EOE
20
+ end
21
+ it "should be able to get a list of the defined methods on the object" do
22
+ @klass.my_methods.should == ["hello"]
23
+ end
24
+ end
@@ -0,0 +1,15 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Module" do
4
+ before(:each) do
5
+ @mod = Module.new do
6
+ attr_accessor_with_default :a do
7
+ Hash.new
8
+ end
9
+ end
10
+ @klass = Class.new.extend(@mod)
11
+ end
12
+ it "should be able to set method accessors" do
13
+ @klass.a.should == {}
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "Object" do
4
+ it "should respond to to_os" do
5
+ Object.new.respond_to?(:to_os).should == true
6
+ end
7
+ describe "with_options" do
8
+ before(:each) do
9
+ @obj = Class.new
10
+ end
11
+ it "should respond to with_options" do
12
+ @obj.respond_to?(:with_options).should == true
13
+ end
14
+ it "should set the options on the parent" do
15
+ allow_message_expectations_on_nil
16
+ @a.should_receive(:clone).and_return @a
17
+ @a.stub!(:options).and_return({})
18
+ with_options({:nick => "name"}, @a) do
19
+ end
20
+ end
21
+
22
+ describe "running" do
23
+ before(:each) do
24
+ Class.stub!(:default_options).and_return({})
25
+ Class.send :include, Configurable
26
+ Class.send :include, MethodMissingSugar
27
+ @a = Class.new
28
+ @b = Class.new
29
+
30
+ with_options({:nick => "name", :b => @b}, @a) do
31
+ b.dude "totally"
32
+ end
33
+
34
+ end
35
+ it "should set the options on the child in the instance eval" do
36
+ @b.dude.should == "totally"
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,152 @@
1
+ require File.dirname(__FILE__) + '/../spec_helper'
2
+
3
+ describe "String" do
4
+ describe "hasherize" do
5
+ before(:each) do
6
+ @str=<<-EOE
7
+ hello world
8
+ you are my
9
+ hero
10
+ EOE
11
+ @hashed = @str.hasherize(%w(hello you))
12
+ end
13
+ it "should return a hash from the string" do
14
+ @hashed.class.should == Hash
15
+ end
16
+ it "should have hello as a key" do
17
+ @hashed.has_key?(:hello).should == true
18
+ end
19
+ describe "arrayable" do
20
+ it "should be able to turn the string into an array" do
21
+ @str.arrayable.class.should == Array
22
+ end
23
+ end
24
+ end
25
+ before(:each) do
26
+ @string = "string"
27
+ @string.stub!(:bucket_objects).and_return([])
28
+ end
29
+ # Dumb test
30
+ it "should be able to call bucket_objects on itself" do
31
+ @string.should_receive(:bucket_objects)
32
+ @string.bucket_objects
33
+ end
34
+ describe "with config replacements" do
35
+ it "should replace those syms in the string" do
36
+ ("new :port" ^ {:port => 100}).should == "new 100"
37
+ end
38
+ it "should be able to detect vars" do
39
+ @string=<<-EOC
40
+ listen web_proxy 127.0.0.1::client_port
41
+ \tserver web1 127.0.0.1::port weight 1 minconn 3 maxconn 6 check inter 30000
42
+ EOC
43
+ (@string ^ {:client_port => 3000, :port => 3001}).should ==<<-EOO
44
+ listen web_proxy 127.0.0.1:3000
45
+ \tserver web1 127.0.0.1:3001 weight 1 minconn 3 maxconn 6 check inter 30000
46
+ EOO
47
+ end
48
+ end
49
+ describe "collect_each_line_with_index" do
50
+ before(:each) do
51
+ @longer_string = "hot\npotato\nthrough\nthe\nwindow"
52
+ end
53
+ it "should run the same code on the entire string" do
54
+ @longer_string.collect_each_line_with_index do |str, index|
55
+ "#{index}_#{str}"
56
+ end.should == ["0_hot", "1_potato", "2_through", "3_the", "4_window"]
57
+ end
58
+ end
59
+ describe "String" do
60
+ before(:each) do
61
+ @str =<<-EOS
62
+ echo 'hi'
63
+ puts 'hi'
64
+ EOS
65
+ end
66
+ it "should be able to convert a big string with \n to a runnable string" do
67
+ @str.runnable.should == "echo 'hi' && puts 'hi'"
68
+ end
69
+ end
70
+ describe "Constantize" do
71
+ before(:each) do
72
+ @str = "prok"
73
+ end
74
+ it "should be able to turn itself into constant" do
75
+ @str.class_constant.should == PoolPartyProkClass
76
+ end
77
+ it "should turn itself into a class constant" do
78
+ @str.class_constant.class.should == Class
79
+ end
80
+ it "should not recreate the constant if it exists" do
81
+ Class.should_receive(:new).once.and_return Class.new
82
+ @str.class_constant
83
+ @str.class_constant
84
+ end
85
+ it "should set the parent class when sent with the superclass" do
86
+ "stirer".class_constant(String).ancestors[1].should == String
87
+ end
88
+ it "should be able to create a module into a constant" do
89
+ @str.module_constant.should == ProkModule
90
+ end
91
+ it "should turn itself into a class constant" do
92
+ @str.module_constant.class.should == Module
93
+ end
94
+ it "should create the module on preserved module constant" do
95
+ Module.should_receive(:new).once
96
+ @str.preserved_module_constant.should == Prok
97
+ @str.preserved_module_constant
98
+ @str.preserved_module_constant
99
+ end
100
+ describe "with a block" do
101
+ before(:each) do
102
+ @str = "nack"
103
+ end
104
+ it "should be able to yield a block on the module and set methods" do
105
+ "tippy".module_constant do
106
+ def tippy
107
+ puts "etc"
108
+ end
109
+ end
110
+ Class.new.extend("tippy".module_constant).methods.include?("tippy").should == true
111
+ end
112
+ end
113
+ end
114
+ describe "top level class" do
115
+ it "should be able to get the top level class" do
116
+ "PoolParty::Resources::File".top_level_class.should == "file"
117
+ end
118
+ end
119
+ describe "to_option_string" do
120
+ it "should not touch a string, but return the string with single quotes" do
121
+ "rocks".to_option_string.should == "'rocks'"
122
+ end
123
+ it "should return a string of the format Service[nagios] with no single quotes" do
124
+ "Service[nagios]".to_option_string.should == "Service[nagios]"
125
+ end
126
+ it "should also return a string if there is a string within the string" do
127
+ 'Package["heartbeat-2"]'.to_option_string.should == 'Package["heartbeat-2"]'
128
+ end
129
+ it "should return File['/etc/apache2/conf.d/base.conf'] as a string" do
130
+ 'File["/etc/apache2/conf.d/base.conf"]'.to_option_string.should == "File[\"/etc/apache2/conf.d/base.conf\"]"
131
+ end
132
+ end
133
+ describe "sanitize" do
134
+ it "should remove the periods from the string" do
135
+ "xnot.org".sanitize.should == "xnotorg"
136
+ end
137
+ end
138
+ describe "nice_runnable" do
139
+ before(:each) do
140
+ @tasks = ["ls -l", "echo 'hello'"]
141
+ end
142
+ it "should turn an array into a string" do
143
+ @tasks.nice_runnable.class.should == String
144
+ end
145
+ it "should add \\n between the commands" do
146
+ @tasks.nice_runnable.should == "ls -l \n echo 'hello'"
147
+ end
148
+ it "should strip out excess lines" do
149
+ (@tasks << []).nice_runnable.should == "ls -l \n echo 'hello'"
150
+ end
151
+ end
152
+ end