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.15.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.14.2 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.14.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.14.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.13.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.13.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.12.5 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.12.3 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.12.2 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.12.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.12.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.11.3 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.11.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.11.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.10.1 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.10.0 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.9.6 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.9.4 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.9.3 spec/opsicle/monitor/spy/deployments_spec.rb
opsicle-2.9.2 spec/opsicle/monitor/spy/deployments_spec.rb