Sha256: 60f294e3fa42cc3687bc59e91a0a722565af15e3ab75119d96f208f687a5f08a

Contents?: true

Size: 1.27 KB

Versions: 12

Compression:

Stored size: 1.27 KB

Contents

require "spec_helper"

describe Brightbox::BBConfig do
  let(:contents) do
    <<-EOS
    [core]
    default_client = fnord

    [fnord]
    client_id = cli-12345
    alias = test

    [jason.null@brightbox.com]
    client_id = app-12345
    alias = dev
    EOS
  end
  let(:config) { config_from_contents(contents) }

  describe "#client_named?" do
    context "when no client with that name" do
      it "returns false" do
        expect(config.client_named?("missing")).to be false
      end
    end

    context "when client with that ID exists" do
      it "returns false" do
        expect(config.client_named?("cli-12345")).to be false
      end
    end

    context "when client with that alias exists" do
      it "returns true" do
        expect(config.client_named?("test")).to be true
      end
    end

    context "when client with that alias exists" do
      it "returns true" do
        expect(config.client_named?("dev")).to be true
      end
    end

    context "when client a section header exists" do
      it "returns true" do
        expect(config.client_named?("jason.null@brightbox.com")).to be true
      end
    end

    context "when client is named 'core'" do
      it "returns false" do
        expect(config.client_named?("core")).to be false
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
brightbox-cli-2.2.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-2.1.2 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-2.1.1 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-2.1.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-2.0.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.6.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.5.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.4.3 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.4.2 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.4.1 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.4.0 spec/unit/brightbox/bb_config/client_named_spec.rb
brightbox-cli-1.3.0 spec/unit/brightbox/bb_config/client_named_spec.rb