Sha256: d63b701da41805c687e3a6c9baca5360d89685ef9e47e64fef0e99335438a243

Contents?: true

Size: 1.13 KB

Versions: 13

Compression:

Stored size: 1.13 KB

Contents

require 'spec_helper'
require 'gitx/cli/base_command'

describe Gitx::Cli::BaseCommand do
  let(:args) { [] }
  let(:options) { {} }
  let(:config) do
    {
      pretend: true
    }
  end
  let(:cli) { described_class.new(args, options, config) }
  let(:repo) { cli.send(:repo) }

  describe 'without custom .gitx.yml config file' do
    it 'provides default options' do
      expect(cli.send(:config).config).to eq Gitx::Configuration::DEFAULT_CONFIG
    end
  end

  describe 'with custom .gitx.yml config file' do
    let(:config) do
      {
        'aggregate_branches' => %w( foo bar ),
        'reserved_branches' => %w( baz qux ),
        'taggable_branches' => %w( quux corge )
      }
    end
    before do
      expect(repo).to receive(:workdir).and_return(temp_dir)
      File.open(File.join(temp_dir, '.gitx.yml'), 'w') do |f|
        f.puts config.to_yaml
      end
    end
    it 'overrides default options' do
      expect(cli.send(:config).aggregate_branches).to eq(%w( foo bar ))
      expect(cli.send(:config).reserved_branches).to eq(%w( baz qux ))
      expect(cli.send(:config).taggable_branches).to eq(%w( quux corge ))
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
gitx-2.14.1.ci.62.1 spec/gitx/cli/base_command_spec.rb
gitx-2.14.1 spec/gitx/cli/base_command_spec.rb
gitx-2.14.0.ci.56.1 spec/gitx/cli/base_command_spec.rb
gitx-2.14.0 spec/gitx/cli/base_command_spec.rb
gitx-2.13.7 spec/gitx/cli/base_command_spec.rb
gitx-2.13.7.ci.52.1 spec/gitx/cli/base_command_spec.rb
gitx-2.13.6 spec/gitx/cli/base_command_spec.rb
gitx-2.13.6.ci.50.1 spec/gitx/cli/base_command_spec.rb
gitx-2.13.5.ci.46.1 spec/gitx/cli/base_command_spec.rb
gitx-2.13.5 spec/gitx/cli/base_command_spec.rb
gitx-2.13.4.ci.39.1 spec/gitx/cli/base_command_spec.rb
gitx-2.13.4 spec/gitx/cli/base_command_spec.rb
gitx-2.13.3 spec/gitx/cli/base_command_spec.rb