Sha256: 5bfc8ae5001dec6cc6ed10fd7193baa964cf91d5e6824cfbb846beb6966798d7

Contents?: true

Size: 830 Bytes

Versions: 12

Compression:

Stored size: 830 Bytes

Contents

require "spec_helper"
require "tmpdir"

describe Brightbox::BBConfig do

  describe "#config_directory_exists?" do
    let(:config) { Brightbox::BBConfig.new(:directory => @dir) }

    context "when directory exists" do
      it "returns true" do
        Dir.mktmpdir do |dir|
          @dir = dir
          expect(config.config_directory_exists?).to be true
        end
      end
    end

    context "when a file exists with the name" do
      it "returns false" do
        Tempfile.open("config_clash") do |tmp_file|
          @dir = tmp_file.path
          expect(config.config_directory_exists?).to be false
        end
      end
    end

    context "when directory does not exist" do
      it "returns false" do
        @dir = "fnord"
        expect(config.config_directory_exists?).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/config_directory_exists_spec.rb
brightbox-cli-2.1.2 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-2.1.1 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-2.1.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-2.0.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.6.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.5.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.4.3 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.4.2 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.4.1 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.4.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb
brightbox-cli-1.3.0 spec/unit/brightbox/bb_config/config_directory_exists_spec.rb