Sha256: 440c309ec854860b75cb552e892f961d8443ec93a0b92b3fbac200251777bbd2

Contents?: true

Size: 1.18 KB

Versions: 7

Compression:

Stored size: 1.18 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe CacheInformation do

  def cache_information(options={})
    CacheInformation.new({:path => '/index.html'}.merge(options))
  end

  it 'should have path attribute' do
    CacheInformation.new.should respond_to(:path)
  end

  it 'should be valid' do
    cache_information.should be_valid
  end

  it 'should not save without path' do
    cache_information(:path => nil).should_not be_valid
  end

  it 'should have path unique' do
    cache_information.save
    cache_information.should_not be_valid
  end

  it 'should destroy file in path when destroy' do
    file_path = create_file_in_spec_public_cache_directory('index.html')
    CacheInformation.create!(:path => '/index.html').destroy
    File.should_not be_exist(file_path)
  end

  it "should destroy himself if path doesn't exist" do
    CacheInformation.create!(:path => '/index.html').destroy
    CacheInformation.find_by_path('/index.html').should be_nil
  end

  it "should logged in warning the path if path doesn't exist" do
    Rails.logger.should_receive(:warn).with("path : /index.html no more exist")
    CacheInformation.create!(:path => '/index.html').destroy
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
typo-5.4.4 spec/models/cache_information_spec.rb
typo-5.4.3 spec/models/cache_information_spec.rb
typo-5.4.2 spec/models/cache_information_spec.rb
typo-5.4.1 spec/models/cache_information_spec.rb
typo-5.4 spec/models/cache_information_spec.rb
typo-5.2.98 spec/models/cache_information_spec.rb
typo-5.3 spec/models/cache_information_spec.rb