Sha256: 767f286ec99ceb83f72b8d41155e1b36c45b1ffc0e9c923c7aa0b4a8f88f62f2

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 KB

Contents

# encoding: utf-8
require 'spec_helper'

describe Actions::AddExamplesToTestCasesDirectory do
  let(:examples_directory) { File.join(working_directory, 'test_cases.d', 'examples') }

  let(:repo) do
    Rugged::Repository.init_at(git_repo)
  end
  context '#initialize' do
    it 'requires a path' do
      Actions::AddExamplesToTestCasesDirectory.new(examples_directory)
    end
  end

  context '#run' do
    it 'runs the action' do
      action = Actions::AddExamplesToTestCasesDirectory.new(examples_directory)
      silence(:stderr) do
        action.run
      end

      expect(path_exists?('test_cases.d/examples')).to be_true
    end

    it 'respects existing path' do
      create_directory('test_cases.d/examples')

      action = Actions::AddExamplesToTestCasesDirectory.new(examples_directory)

      result = capture(:stderr) do
        ProxyTester.ui_logger.level = :info
        action.run
      end

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

    it 'does overwrite existing files if forced to' do
      create_directory('test_cases.d/examples')

      action = Actions::AddExamplesToTestCasesDirectory.new(examples_directory, force: true)

      result = capture(:stderr) do
        ProxyTester.ui_logger.level = :info
        action.run
      end

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
proxy_tester-0.1.6 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.5 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.4 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.3 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.2 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.1 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.1.0 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.9 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.8 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.7 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.6 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.5 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.4 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.3 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.2 spec/actions/add_examples_to_test_cases_directory_spec.rb
proxy_tester-0.0.1 spec/actions/add_examples_to_test_cases_directory_spec.rb