Sha256: cf0a0299c5be1309282ee30ff1e0c896e27b5deacaf98b22bfb3249db6fbd2a0

Contents?: true

Size: 1.61 KB

Versions: 28

Compression:

Stored size: 1.61 KB

Contents

require "spec_helper"

describe Brightbox::Config::UserApplication do
  let(:client_name) { "app-12345" }
  let(:config) { config_from_contents(contents) }
  let(:config_section) { config[client_name] }

  subject(:section) { Brightbox::Config::UserApplication.new(config_section, client_name) }

  describe "#valid?" do
    context "when config is valid" do
      let(:contents) do
        <<-EOS
        [#{client_name}]
        api_url = http://api.brightbox.dev
        username = user@example.com
        EOS
      end

      it "is valid" do
        expect(section).to be_valid
      end
    end

    context "when config has additional values" do
      let(:contents) do
        <<-EOS
        [#{client_name}]
        api_url = http://api.brightbox.dev
        client_id = #{client_name}
        secret = #{random_token}
        username = user@example.com
        theme = blue
        EOS
      end

      it "is valid" do
        expect(section).to be_valid
      end
    end

    context "when config is missing api_url" do
      let(:contents) do
        <<-EOS
        [#{client_name}]
        client_id = #{client_name}
        secret = #{random_token}
        username = user@example.com
        EOS
      end

      it "is invalid" do
        expect(section).to_not be_valid
      end
    end

    context "when config is missing username" do
      let(:contents) do
        <<-EOS
        [#{client_name}]
        api_url = http://api.brightbox.dev
        client_id = #{client_name}
        secret = #{random_token}
        EOS
      end

      it "is invalid" do
        expect(section).to_not be_valid
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
brightbox-cli-2.5.0 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.4.1 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.4.0 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.3.4 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.3.3 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.3.2 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.3.1 spec/unit/brightbox/config/user_application/valid_spec.rb
brightbox-cli-2.3.0 spec/unit/brightbox/config/user_application/valid_spec.rb