Sha256: 45aaeb9dd0fbc81ffd699ddbabe537e90fa76780b606df40572d4b4b8648bcf9

Contents?: true

Size: 1007 Bytes

Versions: 41

Compression:

Stored size: 1007 Bytes

Contents

# -*- coding: utf-8 -*-
require 'spec_helper'

describe Magellan::Cli::FileAccess do
  describe :ensure_config_dir do
    before do
      @stdout = StringIO.new
      @stdout_orig, $stdout = $stdout, @stdout
      expect(File).to receive(:directory?).with(File.expand_path("~/.config/magellan")).and_return(false)
      expect(FileUtils).to receive(:mkdir_p).with(File.expand_path("~/.config/magellan"))
      @magellan_cli_config_file_orig, ENV["MAGELLAN_CLI_CONFIG_FILE"] = ENV["MAGELLAN_CLI_CONFIG_FILE"], nil
    end
    after do
      $stdout = @stdout_orig
      ENV["MAGELLAN_CLI_CONFIG_FILE"] = @magellan_cli_config_file_orig
    end
    it "print notification message" do
      Magellan::Cli::FileAccess.ensure_config_dir
      [
        %r{\.config/magellan/magellan-cli },
        %r{configuration file}i,
        %r{environment variable}i,
        %r{MAGELLAN_CLI_CONFIG_FILE},
        %r{migration}i,
      ].each do |re|
        expect(@stdout.string).to match(re)
      end
    end
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
magellan-cli-0.11.1 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.11.0 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.10.0 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.9.1 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.9.0 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.8.3 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.8.2 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.8.1 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.8.0 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.11 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.10 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.9 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.8 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.7 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.6 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.5 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.4 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.3 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.2 spec/magellan/cli/file_access_spec.rb
magellan-cli-0.7.1 spec/magellan/cli/file_access_spec.rb