Sha256: 9d7955a187518092d078028adb22f697c01b18bff7c7fe9137ad231967b2ddcf

Contents?: true

Size: 1.15 KB

Versions: 1

Compression:

Stored size: 1.15 KB

Contents

require 'spec_helper'

describe LitmusPaper::Dependency::HaproxyBackends do
  describe "available?" do
    before(:each) do
      FileUtils.rm_rf("/tmp/stub-haproxy-stats")
      system "spec/support/haproxy_test_socket /tmp/stub-haproxy-stats &"
      sleep 1
    end

    it "is available if at least one backend is up" do
      pending "Broken on TravisCI 1.9.x; works locally" if ENV["TRAVIS_RUBY_VERSION"] =~ /\A1.9/
      haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "yellow_cluster")
      haproxy.should be_available
    end

    it "returns 0 if no nodes are available" do
      pending "Broken on TravisCI 1.9.x; works locally" if ENV["TRAVIS_RUBY_VERSION"] =~ /\A1.9/
      haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "orange_cluster")
      haproxy.should_not be_available
    end
  end

  describe "to_s" do
    it "includes the socket file and the cluster" do
      haproxy = LitmusPaper::Dependency::HaproxyBackends.new("/tmp/stub-haproxy-stats", "orange_cluster")
      haproxy.to_s.should == 'Dependency::HaproxyBackends(/tmp/stub-haproxy-stats, orange_cluster)'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
litmus_paper-0.3.2 spec/litmus_paper/dependency/haproxy_backends_spec.rb