Sha256: d0861a0e1042193807fbafa3ea246754328412e52c99207f736db8fa872f3710

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

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
    
    pending "should raise error if varnish is not available"
  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
  
  context "(purge multiple hosts)" do
    before(:each) do
      ActionController::Base.perform_caching = true
    end
    
    it "should purge more than one hosts" do
      Varnish::Client.any_instance.should_receive(:purge).with("req.http.host ~ ^(mobile.bitflut.com|bitflut.com) && req.url ~ ^/$")
      ActionController::Base.purge("/", false, ["mobile.bitflut.com", "bitflut.com"])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
shellac-0.0.3.rc2 spec/shellac_spec.rb