spec/revenc/io_spec.rb in revenc-0.1.3 vs spec/revenc/io_spec.rb in revenc-0.2.1
- old
+ new
@@ -1,25 +1,25 @@
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe Revenc::FileSystemEntity do
-
+
before(:each) do
FileUtils.rm_rf(current_dir)
end
describe Revenc::TextFile do
-
+
it "should be valid" do
filename = "text_file"
- create_file(filename, "passphrase")
+ write_file(filename, "passphrase")
text_file = Revenc::TextFile.new(fullpath(filename))
text_file.should be_valid
end
it "should return a fully qualified file name" do
filename = "text_file"
- create_file(filename, "passphrase")
+ write_file(filename, "passphrase")
relative_path_filename = File.join('tmp', 'aruba', filename)
text_file = Revenc::TextFile.new(relative_path_filename)
text_file.should be_valid
text_file.name.should_not be(filename)
text_file.name.should_not be(relative_path_filename)
@@ -34,11 +34,11 @@
text_file.name.should be(relative_path_filename)
end
it "should be valid if empty" do
filename = "text_file"
- create_file(filename, "")
+ write_file(filename, "")
text_file = Revenc::TextFile.new(fullpath(filename))
text_file.should be_valid
end
it "should not be valid if name missing" do
@@ -48,18 +48,18 @@
describe Revenc::PassphraseFile do
it "should be valid" do
filename = "text_file"
- create_file(filename, "passphrase")
+ write_file(filename, "passphrase")
text_file = Revenc::PassphraseFile.new(fullpath(filename))
text_file.should be_valid
end
it "should not be valid if empty" do
filename = "text_file"
- create_file(filename, "")
+ write_file(filename, "")
text_file = Revenc::PassphraseFile.new(fullpath(filename))
text_file.exists?.should be(true)
text_file.should_not be_valid
text_file.errors.to_sentences.should match(/is empty/)
end
@@ -68,18 +68,18 @@
describe Revenc::KeyFile do
it "should be valid" do
filename = "encfs6.xml"
- create_file(filename, "DOCTYPE boost_serialization")
+ write_file(filename, "DOCTYPE boost_serialization")
text_file = Revenc::KeyFile.new(fullpath(filename))
text_file.should be_valid
end
it "should not be valid if empty" do
filename = "encfs6.xml"
- create_file(filename, "")
+ write_file(filename, "")
text_file = Revenc::KeyFile.new(fullpath(filename))
text_file.exists?.should be(true)
text_file.should_not be_valid
text_file.errors.to_sentences.should match(/is empty/)
end
@@ -87,11 +87,11 @@
end
end
describe Revenc::FileFolder do
-
+
it "should be valid if empty" do
foldername = "folder1"
create_dir(foldername)
file_folder = Revenc::FileFolder.new(fullpath(foldername))
file_folder.should be_valid
@@ -143,11 +143,11 @@
file_folder.cmd.should eql("hello #{file_folder.name}")
file_folder.cmd.should_not eql("hello ")
end
describe Revenc::MountPoint do
-
+
it "should have an accessor 'mountpoint' equal to self" do
foldername = "folder1"
mountpoint = Revenc::MountPoint.new(fullpath(foldername))
mountpoint.name.should eql(fullpath(foldername))
mountpoint.mountpoint.name.should == mountpoint.name
@@ -164,10 +164,10 @@
file_folder.errors.to_sentences.should match(/encfs executable not found/)
end
end
describe Revenc::UnmountPoint do
-
+
it "should not be valid if fusermount executable not found" do
# stub out check for executable with double that can't find fusermount
double = Revenc::UnmountPoint.new
double.stub!(:executable).and_return('')
Revenc::UnmountPoint.stub!(:new).and_return(double)