require 'spec_helper' describe 'Roqua::StatusChecks::CheckLoadBalancerMember' do it 'returns true when the status file contains on' do allow(File).to receive(:read).and_return('on') expect(Roqua::StatusChecks::CheckLoadBalancerMember.balancer_member?('foo/bar')).to be_truthy end it 'returns false when the status file does not contain off' do allow(File).to receive(:read).and_return('off') expect(Roqua::StatusChecks::CheckLoadBalancerMember.balancer_member?('foo/bar')).to be_falsey end it 'raises InvalidStatus error when the status file contains something else' do allow(File).to receive(:read).and_return('foo') expect { Roqua::StatusChecks::CheckLoadBalancerMember.balancer_member?('foo/bar') } .to raise_error(Roqua::StatusChecks::CheckLoadBalancerMember::InvalidStatus, 'Invalid state: foo') end end