Sha256: a9e102085305ab005ecfd10f41e24f871f705c5b598ec879bfe1351005bc3bc1

Contents?: true

Size: 748 Bytes

Versions: 1

Compression:

Stored size: 748 Bytes

Contents

require 'helper'

class TestLacquer < ActiveSupport::TestCase
  setup do
    Lacquer.configure do |config|
      config.varnish_servers << { :host => '0.0.0.0', :port => 6082 }
    end 

    @telnet_mock = mock('Net::Telnet')
    @telnet_mock.stubs(:cmd)

    @controller = ControllerClass.new
  end

  context "when connection is succesful" do
    should "send command to varnish server" do
      Net::Telnet.stubs(:new).returns(@telnet_mock)
      Lacquer::Varnish.new.purge('/')
    end
  end

  context "when connection is unsuccesful" do
    should "raise timeout exception" do
      Net::Telnet.stubs(:new).raises(Timeout::Error)
      assert_raise Lacquer::VarnishError do
        Lacquer::Varnish.new.purge('/')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lacquer-0.2.3 test/test_varnish_interface.rb