Sha256: 99ac33177bd0fe7e3ca6f9050d0d544032f0772d217b6aa82f044cb748a16c80

Contents?: true

Size: 749 Bytes

Versions: 1

Compression:

Stored size: 749 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(:puts)

    @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.2 test/test_varnish_interface.rb