spec/kuzushi_spec.rb in kuzushi-0.0.23 vs spec/kuzushi_spec.rb in kuzushi-0.0.24
- old
+ new
@@ -75,7 +75,32 @@
@kuzushi.expects(:http_get).with("#{@url}/templates/mycrontab.erb").returns("Hello <%= 'world' %>")
@kuzushi.expects(:put_file).with("Hello world", tmpfile = "/tmp/kuzushi/mycrontab.erb")
@kuzushi.expects(:shell).with("crontab -u root #{tmpfile}")
should.not.raise { @kuzushi.start }
end
+
+ it "will run external scripts" do
+ @kuzushi.stubs(:config).returns( {
+ "before" => "script.sh"
+ })
+ @kuzushi.expects(:external_script).with("script.sh")
+ should.not.raise { @kuzushi.start }
+ end
+
+ it "will run inline scripts" do
+ @kuzushi.stubs(:config).returns( {
+ "before" => "#!/bin/bash\n echo 'hello'\n"
+ })
+ @kuzushi.expects(:inline_script).with("#!/bin/bash\n echo 'hello'\n")
+ should.not.raise { @kuzushi.start }
+ end
+
+ it "will run sets of scripts" do
+ @kuzushi.stubs(:config).returns( {
+ "before" => [ "script.sh", "#!/bin/bash\n echo 'hello'\n" ]
+ })
+ @kuzushi.expects(:inline_script).with("#!/bin/bash\n echo 'hello'\n")
+ @kuzushi.expects(:external_script).with("script.sh")
+ should.not.raise { @kuzushi.start }
+ end
end