Sha256: 6d8238135496b0855393b77c4541fbf6a9bddd0d81623b386a6eeb7925d2c3fe
Contents?: true
Size: 990 Bytes
Versions: 6
Compression:
Stored size: 990 Bytes
Contents
require "massive_sitemap/lock" describe MassiveSitemap do describe "lock!" do let(:lock_file) { MassiveSitemap::LOCK_FILE } after do FileUtils.rm(lock_file) rescue nil end it 'does nothing without block' do MassiveSitemap.lock! ::File.exists?(lock_file).should be_false end it 'creates lockfile' do File.exists?(lock_file).should be_false MassiveSitemap.lock! do ::File.exists?(lock_file).should be_true end end it 'deletes lockfile' do MassiveSitemap.lock! {} ::File.exists?(lock_file).should be_false end it 'deletes lockfile in case of error' do expect do MassiveSitemap.lock! do raise ArgumentError end end.to raise_error ::File.exists?(lock_file).should be_false end it 'fails if lockfile exists' do ::File.open(lock_file, 'w') {} expect do MassiveSitemap.lock! {} end.to raise_error end end end
Version data entries
6 entries across 6 versions & 1 rubygems