Sha256: ff9fa518d1c3a85290d05cfe6039b1760b00e7e0dbed63f048ac5dba7699b2b6

Contents?: true

Size: 1.18 KB

Versions: 10

Compression:

Stored size: 1.18 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 = :info
        action.run
      end

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
local_pac-0.10.2 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.10.1 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.10.0 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.9.0 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.7.0 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.6.3 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.6.2 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.6.1 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.5.0 spec/actions/add_examples_to_local_storage_spec.rb
local_pac-0.4.0 spec/actions/add_examples_to_local_storage_spec.rb