Sha256: ecf23a9cf077e244f111c4b064609434e92f8443b4b246d3c0c86e1d052f25fb
Contents?: true
Size: 1022 Bytes
Versions: 1
Compression:
Stored size: 1022 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! do puts "Hi" end end.to raise_error end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
massive_sitemap-2.0.0.rc5 | spec/lock_spec.rb |