Sha256: 35e8b863f971d803905d9f579d3ad8d2dcd2976087dcb3f17f390f78d61a9e05

Contents?: true

Size: 1 KB

Versions: 60

Compression:

Stored size: 1 KB

Contents

require 'spec_helper'
require 'opsicle'

describe Opsicle::Monitor::Spy::Deployments do
  before do
    @deployments = double(:data => {})

    expect(Opsicle::Deployments).to receive(:new).and_return(@deployments)

    @subject = Opsicle::Monitor::Spy::Deployments.new
  end

  describe "#user_from_arn" do
    it "parses a normal user string" do
      result = @subject.user_from_arn("arn:aws:iam::465198754621:user/chris.arcand")
      expect(result).to eq("chris.arcand")
    end

    it "parses a root user string" do
      result = @subject.user_from_arn("arn:aws:iam::465198754621:root")
      expect(result).to eq("root")
    end

    it "handles an unknown string gracefully" do
      result = @subject.user_from_arn("Ugly string")
      expect(result).to eq("Ugly string")
    end

    it "handles a nil or empty string gracefully" do
      nilstring = @subject.user_from_arn(nil)
      emptystring = @subject.user_from_arn("")

      expect(nilstring).to eq("")
      expect(nilstring).to eq("")
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
opsicle-2.9.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.8.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.6.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.5.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.4.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.4.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.3.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.3.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.2.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.2.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.1.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.0.2 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.0.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.0.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-1.1.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-1.1.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-1.0.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-0.18.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-0.18.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-0.16.0 spec/opsicle/monitor/spy/deployments_spec.rb