aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/lock_file_spec.rb
diff options
context:
space:
mode:
authorMarkus Reiter2017-05-22 03:23:50 +0200
committerMarkus Reiter2017-05-25 06:18:52 +0200
commit060af0a26ab7219e46b500fd1c7f420b6cc74cbb (patch)
tree649593bf35ab82c344d7f7ca9456f26d118f6f45 /Library/Homebrew/test/lock_file_spec.rb
parente931fee732d9d8d34eb9d689782bafb3822302f7 (diff)
downloadbrew-060af0a26ab7219e46b500fd1c7f420b6cc74cbb.tar.bz2
Rename `FormulaLock` to `LockFile`.
Diffstat (limited to 'Library/Homebrew/test/lock_file_spec.rb')
-rw-r--r--Library/Homebrew/test/lock_file_spec.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/Library/Homebrew/test/lock_file_spec.rb b/Library/Homebrew/test/lock_file_spec.rb
new file mode 100644
index 000000000..82c47a70a
--- /dev/null
+++ b/Library/Homebrew/test/lock_file_spec.rb
@@ -0,0 +1,34 @@
+require "lock_file"
+
+describe LockFile do
+ subject { described_class.new("foo") }
+
+ describe "#lock" do
+ it "does not raise an error when already locked" do
+ subject.lock
+
+ expect { subject.lock }.not_to raise_error
+ end
+
+ it "raises an error if a lock already exists" do
+ subject.lock
+
+ expect {
+ described_class.new("foo").lock
+ }.to raise_error(OperationInProgressError)
+ end
+ end
+
+ describe "#unlock" do
+ it "does not raise an error when already unlocked" do
+ expect { subject.unlock }.not_to raise_error
+ end
+
+ it "unlocks when locked" do
+ subject.lock
+ subject.unlock
+
+ expect { described_class.new("foo").lock }.not_to raise_error
+ end
+ end
+end