Sha256: db8575ed1bb7a87c00d93ac0c2819f7e3f21ebfd99b6e2311fb9f416b7e99239

Contents?: true

Size: 1.19 KB

Versions: 4

Compression:

Stored size: 1.19 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Actions::AddExamplesToLocalStorage do
  context '#initialize' do
    it 'requires a path to local storage' do
      repo = GitRepository.create(working_directory)

      expect {
        Actions::AddExamplesToLocalStorage.new(working_directory)
      }.not_to raise_error
    end
  end

  context '#run' do
    it 'fails if Storage path does not exist' do
      action = Actions::AddExamplesToLocalStorage.new('local_storage')
      expect {
        action.run
      }.to raise_error Exceptions::RepositoryDoesNotExist
    end

    it 'creates files' do
      repo = GitRepository.create(working_directory)
      action = Actions::AddExamplesToLocalStorage.new(working_directory)
      action.run

      expect(repo.find_file('examples::proxy-complex.pac'.to_sym).name).to eq(:'examples::proxy-complex.pac')
    end

    it 'forces creation' do
      repo = GitRepository.create(working_directory)
      action = Actions::AddExamplesToLocalStorage.new(working_directory)
      action.run

      result = capture(:stderr) do
        LocalPac.ui_logger.level = ::Logger::INFO
        action.run
      end

      expect(result).to include('already')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
local_pac-0.3.0 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.2.3 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.2.2 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.2.1 spec/actions/add_examples_to_local_storage_spec.rb