Sha256: ea70177108fe9bda436edc7e6d58555879501d9963598a89b638a82999b75999

Contents?: true

Size: 912 Bytes

Versions: 1

Compression:

Stored size: 912 Bytes

Contents

require 'helper'

describe TomatoHarvest::Config do

  describe '.load' do
    let(:global_options) do
      {
        project: 'Project',
        type:    'Ruby Development',
      }
    end

    before do
      File.open(TomatoHarvest::Config::CONFIG_PATH, 'w') do |file|
        YAML::dump(global_options, file)
      end
    end

    it 'loads from the yaml config file' do
      expect(TomatoHarvest::Config.load).to eql(global_options)
    end

    context 'when there is a config file in the current dir' do

      it 'overrides global config' do
        options = {
          type:    'JS Development',
        }
        local_config = File.join(Dir.pwd, '.tomaconfig')

        File.open(local_config, 'w') do |file|
          YAML::dump(options, file)
        end

        result = global_options.merge(options)

        expect(TomatoHarvest::Config.load).to eql(result)
      end

    end

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tomatoharvest-0.0.1 spec/lib/tomatoharvest/config_spec.rb