Sha256: ff7b41ce410545f24ebf255ecf36723ef2ed243c2b4ac83f996600130c8e191f

Contents?: true

Size: 875 Bytes

Versions: 5

Compression:

Stored size: 875 Bytes

Contents

# encoding: utf-8

require 'spec_helper'

RSpec.describe TTY::Terminal::Home, '#find_home' do
  context 'on unix' do
    it "finds home" do
      platform = spy(:windows? => false)
      home = described_class.new(platform)
      allow(home).to receive(:unix_home).and_return('/users/piotr')
      allow(File).to receive(:expand_path).and_return('/users/piotr')
      expect(home.find_home).to eq('/users/piotr')
      expect(home).to have_received(:unix_home)
    end
  end

  context 'on windows' do
    it "finds home" do
      platform = spy(:windows? => true)
      home = described_class.new(platform)
      allow(home).to receive(:windows_home).and_return('C:\Users\Piotr')
      allow(File).to receive(:expand_path).and_return('C:\Users\Piotr')
      expect(home.find_home).to eq('C:\Users\Piotr')
      expect(home).to have_received(:windows_home)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tty-0.5.0 spec/tty/terminal/home_spec.rb
tty-0.4.0 spec/tty/terminal/home_spec.rb
tty-0.3.2 spec/tty/terminal/home_spec.rb
tty-0.3.1 spec/tty/terminal/home_spec.rb
tty-0.3.0 spec/tty/terminal/home_spec.rb