Sha256: cff16415aab3b69f7dc62b91c7d16cab286012cc4ada87eec2eb4840d907a2d1

Contents?: true

Size: 1.18 KB

Versions: 32

Compression:

Stored size: 1.18 KB

Contents

require File.expand_path('../spec_helper', __FILE__)

module XcodeInstall
  describe Command::List do
    before do
      installer.stubs(:exists).returns(true)
      installer.stubs(:installed_versions).returns([])
    end

    def installer
      @installer ||= Installer.new
    end

    def fake_xcode(name)
      fixture = Pathname.new('spec/fixtures/xcode_63.json').read
      xcode = Xcode.new(JSON.parse(fixture))
      xcode.stubs(:name).returns(name)
      xcode
    end

    def fake_xcodes(*names)
      xcodes = names.map { |name| fake_xcode(name) }
      installer.stubs(:xcodes).returns(xcodes)
    end

    describe '#list' do
      it 'lists all versions' do
        fake_xcodes '1', '2.3', '3 some', '4 beta'
        installer.list.should == "1\n2.3\n3 some\n4 beta"
      end
    end

    describe '#list_current' do
      it 'shows versions from latest version only' do
        fake_xcodes '2', '3.0', '3.1', '1.1'
        installer.list_current.should == "3.0\n3.1"
      end

      it 'shows versions of new beta releases too' do
        fake_xcodes '5', '6.1', '6', '6.4 beta', '7 beta'
        installer.list_current.should == "6\n6.1\n6.4 beta\n7 beta"
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
xcode-install-2.1.0 spec/list_spec.rb
xcode-install-2.0.9 spec/list_spec.rb
xcode-install-2.0.8 spec/list_spec.rb
xcode-install-2.0.7 spec/list_spec.rb
xcode-install-2.0.6 spec/list_spec.rb
xcode-install-2.0.5 spec/list_spec.rb
xcode-install-2.0.4 spec/list_spec.rb
xcode-install-2.0.3 spec/list_spec.rb
xcode-install-2.0.2 spec/list_spec.rb
xcode-install-2.0.1 spec/list_spec.rb
xcode-install-2.0.0 spec/list_spec.rb
xcode-install-1.4.0 spec/list_spec.rb
xcode-install-1.3.0 spec/list_spec.rb
xcode-install-1.2.6 spec/list_spec.rb
xcode-install-1.2.5 spec/list_spec.rb
xcode-install-1.2.4 spec/list_spec.rb
xcode-install-1.2.3 spec/list_spec.rb
xcode-install-1.2.2 spec/list_spec.rb
xcode-install-1.2.1 spec/list_spec.rb
xcode-install-1.2.0 spec/list_spec.rb