spec/converge_spec.rb in org-converge-0.0.13 vs spec/converge_spec.rb in org-converge-0.0.14
- old
+ new
@@ -157,6 +157,35 @@
success = o.execute!
success.should == true
result = File.open("#{example_dir}/out.log").read
result.should == "whoosh\n1\n2\n3\n4\n"
end
+
+ it "should be able to chdir the process directory" do
+ example_dir = File.join(EXAMPLES_DIR, 'chdir')
+ setup_file = File.join(example_dir, 'local-run.org')
+
+ o = OrgConverge::Command.new({
+ '<org_file>' => setup_file,
+ '--root-dir' => example_dir
+ })
+ success = o.execute!
+ success.should == true
+ result = File.open("#{example_dir}/subdir/out.log").read
+ result.should == "within subdir\n"
+ end
+
+ it "should support idempotency checks via :if and :unless conditional clauses" do
+ example_dir = File.join(EXAMPLES_DIR, 'idempotency')
+ setup_file = File.join(example_dir, 'conditions.org')
+
+ o = OrgConverge::Command.new({
+ '<org_file>' => setup_file,
+ '--root-dir' => example_dir,
+ '--runmode' => 'idempotent'
+ })
+ success = o.execute!
+ success.should == true
+ result = File.open("#{example_dir}/installed").read
+ result.should == "package is installed\neof\n"
+ end
end