examples/unit/gpg_example.rb in astrails-safe-0.1.7 vs examples/unit/gpg_example.rb in astrails-safe-0.1.8

- old
+ new

@@ -15,20 +15,20 @@ @config = Astrails::Safe::Config::Node.new(nil, config), @backup = Astrails::Safe::Backup.new(backup) ) end - before(:each) do - @gpg = gpg() - stub(@gpg).gpg_password_file {"pwd-file"} - stub(@gpg).pipe {"|gpg -BLAH"} - end - after(:each) { Astrails::Safe::TmpFile.cleanup } describe :process do + before(:each) do + @gpg = gpg() + stub(@gpg).gpg_password_file {"pwd-file"} + stub(@gpg).pipe {"|gpg -BLAH"} + end + describe "when active" do before(:each) do stub(@gpg).active? {true} end @@ -36,11 +36,11 @@ mock(@backup.extension) << '.gpg' @gpg.process end it "should add command pipe" do - mock(@backup.command) << (/\|gpg -/) + mock(@backup.command) << (/\|gpg -BLAH/) @gpg.process end it "should set compressed" do mock(@backup).compressed = true @@ -101,30 +101,30 @@ describe :pipe do describe "with key" do before(:each) do - @gpg = gpg(:gpg => {:key => "foo"}, :options => "OPT") + @gpg = gpg(:gpg => {:key => "foo", :options => "GPG-OPT"}, :options => "OPT") end it "should not call gpg_password_file" do dont_allow(@gpg).gpg_password_file(anything) @gpg.send(:pipe) end - it "should use '-r' and options" do - @gpg.send(:pipe).should == "|gpg OPT -e -r foo" + it "should use '-r' and :options" do + @gpg.send(:pipe).should == "|gpg GPG-OPT -e -r foo" end end describe "with password" do before(:each) do - @gpg = gpg(:gpg => {:password => "bar"}, :options => "OPT") + @gpg = gpg(:gpg => {:password => "bar", :options => "GPG-OPT"}, :options => "OPT") stub(@gpg).gpg_password_file(anything) {"pass-file"} end it "should use '--passphrase-file' and :options" do - @gpg.send(:pipe).should == "|gpg OPT -c --passphrase-file pass-file" + @gpg.send(:pipe).should == "|gpg GPG-OPT -c --passphrase-file pass-file" end end end describe :gpg_password_file do \ No newline at end of file