Sha256: 7dd757594aaf7fe454cbbd6b9c30d162a931a65ac7c75343be2a65dca538c213

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

require 'spec_helper'

describe Conjur::Exists do
  subject { Object.new.tap {|o| o.send :extend, Conjur::Exists } }

  context "when head returns 200" do
    before { subject.stub head: "" }
    its(:exists?) { should be_true }
  end

  context "when forbidden" do
    before { subject.stub(:head) { raise RestClient::Forbidden }}
    it "propagates the error" do
      lambda { subject.exists? }.should raise_error(RestClient::Forbidden)
    end
  end

  context "when not found" do
    before { subject.stub(:head) { raise RestClient::ResourceNotFound }}
    its(:exists?) { should be_false }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
conjur-api-4.10.0 spec/lib/exists_spec.rb
conjur-api-4.9.2 spec/lib/exists_spec.rb