Sha256: 2ed92d7ecd7e3096102192318cc603865421181fb118d65538490f819c76837a

Contents?: true

Size: 922 Bytes

Versions: 2

Compression:

Stored size: 922 Bytes

Contents

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

describe "Shellac" do
  it "should add purge as a class method to ActionController::Base" do
    ActionController::Base.methods.include?(:purge).should be_true
  end
  
  it "should add purge as an instance method to ActionController::Base" do
    ActionController::Base.instance_methods.include?(:purge).should be_true
  end
  
  context "(rails performs caching)" do
    before(:each) do
      ActionController::Base.perform_caching = true
    end
    
    it "should raise error if varnish is not available" do
      lambda {ActionController::Base.purge("/")}.should raise_error(Errno::ECONNREFUSED)
    end
  end
  
  context "(rails doesn't perform caching)" do
    before(:each) do
      ActionController::Base.perform_caching = false
    end
    
    it "should return nil" do
      ActionController::Base.purge("/").should be nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
shellac-0.0.2.4 spec/shellac_spec.rb
shellac-0.0.2.3 spec/shellac_spec.rb