Sha256: e53c074d6b185025b23a6caa9e56645500cb2e7b31d24c9cea5531ace700a77a

Contents?: true

Size: 1.12 KB

Versions: 28

Compression:

Stored size: 1.12 KB

Contents

require "spec_helper"

describe Brightbox::BBConfig do

  describe "#config_directory" do
    context "when default location is used" do
      it "returns a String of the users `.brightbox` directory" do
        config = Brightbox::BBConfig.new

        expanded_path = File.expand_path("~/.brightbox")
        expect(config.config_directory).to eql(expanded_path)
      end
    end

    context "when absolute custom location is set" do
      let(:custom_dir) { Dir.mktmpdir("custom") }

      it "returns a String of the expanded directory" do
        config_options = {
          :directory => custom_dir
        }
        config = Brightbox::BBConfig.new(config_options)

        expect(config.config_directory).to eql(custom_dir)
      end
    end

    context "when custom config location is set" do
      it "returns a String of the expanded directory" do
        config_options = {
          :directory => "~/.cli_config"
        }
        config = Brightbox::BBConfig.new(config_options)

        expanded_path = File.expand_path("~/.cli_config")
        expect(config.config_directory).to eql(expanded_path)
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
brightbox-cli-2.5.0 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.4.1 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.4.0 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.3.4 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.3.3 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.3.2 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.3.1 spec/unit/brightbox/bb_config/config_directory_spec.rb
brightbox-cli-2.3.0 spec/unit/brightbox/bb_config/config_directory_spec.rb