Sha256: b7a1dffbeb829f9b2ae2a602ce902fc2cb049487c52f2d750547c859caa9b234

Contents?: true

Size: 735 Bytes

Versions: 11

Compression:

Stored size: 735 Bytes

Contents

require 'spec_helper'
require 'pathname'

describe Fasterer::Config do
  let(:root) { Pathname.new("#{File.dirname(__FILE__)}/../../..").cleanpath }
  let(:expected_location) { "#{root}/.fasterer.yml" }

  describe '#file_location' do
    it 'returns a file that is in the current dir (eg the project root)' do
      expect(described_class.new.file_location).to eq(expected_location)
    end

    it 'returns a file in an ancestor dir' do
      Dir.chdir("#{root}/spec/lib") do
        expect(described_class.new.file_location).to eq(expected_location)
      end
    end

    it 'returns nil when there is no ancestor file' do
      Dir.tmpdir do
        expect(described_class.new.file_location).to be nil
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fasterer-0.11.0 spec/lib/fasterer/config_spec.rb
fasterer-0.10.1 spec/lib/fasterer/config_spec.rb
fasterer-0.10.0 spec/lib/fasterer/config_spec.rb
fasterer-0.9.0 spec/lib/fasterer/config_spec.rb
fasterer-0.8.3 spec/lib/fasterer/config_spec.rb
fasterer-0.8.2 spec/lib/fasterer/config_spec.rb
fasterer-0.8.1 spec/lib/fasterer/config_spec.rb
fasterer-0.8.0 spec/lib/fasterer/config_spec.rb
fasterer-0.7.1 spec/lib/fasterer/config_spec.rb
fasterer-0.7.0 spec/lib/fasterer/config_spec.rb
fasterer-0.6.0 spec/lib/fasterer/config_spec.rb