Sha256: 43dfe5a77ef543d823094bfb2093b052eb5d05feb229755958a3beae3853bc4d

Contents?: true

Size: 1.25 KB

Versions: 46

Compression:

Stored size: 1.25 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
    before do
      expect(repo).to receive(:workdir).and_return(temp_dir)
    end
    it 'provides default options' do
      expect(cli.send(:config).config).to eq ::YAML.load_file(File.join(__dir__, '../../../lib/gitx/defaults.yml'))
    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

46 entries across 46 versions & 1 rubygems

Version Path
gitx-3.0.0.ci.188.1 spec/gitx/cli/base_command_spec.rb
gitx-3.0.0 spec/gitx/cli/base_command_spec.rb
gitx-2.23.2.ci.182.1 spec/gitx/cli/base_command_spec.rb
gitx-2.23.2 spec/gitx/cli/base_command_spec.rb
gitx-2.23.1.ci.174.1 spec/gitx/cli/base_command_spec.rb
gitx-2.23.1 spec/gitx/cli/base_command_spec.rb
gitx-2.23.0.ci.162.1 spec/gitx/cli/base_command_spec.rb
gitx-2.23.0 spec/gitx/cli/base_command_spec.rb
gitx-2.22.0.ci.154.1 spec/gitx/cli/base_command_spec.rb
gitx-2.22.0 spec/gitx/cli/base_command_spec.rb
gitx-2.21.5.ci.153.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.5.ci.151.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.5 spec/gitx/cli/base_command_spec.rb
gitx-2.21.4.ci.145.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.4 spec/gitx/cli/base_command_spec.rb
gitx-2.21.3.ci.135.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.3 spec/gitx/cli/base_command_spec.rb
gitx-2.21.2.ci.134.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.2.ci.130.1 spec/gitx/cli/base_command_spec.rb
gitx-2.21.2 spec/gitx/cli/base_command_spec.rb