summaryrefslogtreecommitdiff
path: root/spec/install/gemspecs_spec.rb
blob: 201ba9564afc6be79d5c4f357ff17e2a4f0fbdbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'spec_helper'

describe "bundle install" do

  describe "when a gem has a YAML gemspec" do
    before :each do
      build_repo2 do
        build_gem "yaml_spec", :gemspec => :yaml
      end
    end

    it "still installs correctly" do
      gemfile <<-G
        source "file://#{gem_repo2}"
        gem "yaml_spec"
      G
      bundle :install
      expect(err).to be_empty
    end

    it "still installs correctly when using path" do
      build_lib 'yaml_spec', :gemspec => :yaml

      install_gemfile <<-G
        gem 'yaml_spec', :path => "#{lib_path('yaml_spec-1.0')}"
      G
      expect(err).to eq("")
    end
  end

  it "should use gemspecs in the system cache when available" do
    gemfile <<-G
      source "http://localtestserver.gem"
      gem 'rack'
    G

    FileUtils.mkdir_p "#{tmp}/gems/system/specifications"
    File.open("#{tmp}/gems/system/specifications/rack-1.0.0.gemspec", 'w+') do |f|
      spec = Gem::Specification.new do |s|
        s.name = 'rack'
        s.version = '1.0.0'
        s.add_runtime_dependency 'activesupport', '2.3.2'
      end
      f.write spec.to_ruby
    end
    bundle :install, :artifice => 'endpoint_marshal_fail' # force gemspec load
    should_be_installed "activesupport 2.3.2"
  end

end