aboutsummaryrefslogtreecommitdiffstats
path: root/spec/update/svn_spec.rb
blob: 056d798088f1205f4706ddc6014206d1726c5c25 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
require "spec_helper"

describe "bundle update" do
  describe "svn sources" do
    it "updates correctly when you have like craziness" do
      build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport")
      build_svn "rails", "3.0", :path => lib_path("rails") do |s|
        s.add_dependency "activesupport", "= 3.0"
      end

      install_gemfile <<-G
        gem "rails", :svn => "file://#{lib_path('rails')}"
      G

      bundle "update rails"
      expect(out).to include("Using activesupport 3.0 from file://#{lib_path('rails')} (at HEAD)")
      should_be_installed "rails 3.0", "activesupport 3.0"
    end

    it "floats on master when updating all gems that are pinned to the source even if you have child dependencies" do
      build_svn "foo", :path => lib_path('foo')
      build_gem "bar", :to_system => true do |s|
        s.add_dependency "foo"
      end

      install_gemfile <<-G
        gem "foo", :svn => "file://#{lib_path('foo')}"
        gem "bar"
      G

      update_svn "foo", :path => lib_path('foo') do |s|
        s.write "lib/foo.rb", "FOO = '1.1'"
      end

      bundle "update foo"

      should_be_installed "foo 1.1"
    end

    it "notices when you change the repo url in the Gemfile" do
      build_svn "foo", :path => lib_path("foo_one")
      build_svn "foo", :path => lib_path("foo_two")

      install_gemfile <<-G
        gem "foo", "1.0", :svn => "file://#{lib_path('foo_one')}"
      G

      FileUtils.rm_rf lib_path("foo_one")

      install_gemfile <<-G
        gem "foo", "1.0", :svn => "file://#{lib_path('foo_two')}"
      G

      expect(err).to be_empty
      expect(out).to include("Fetching file://#{lib_path}/foo_two")
      expect(out).to include("Bundle complete!")
    end

    it "should not explode on invalid revision on update of gem by name" do
      build_svn "rack", "0.8"

      build_svn "rack", "0.8", :path => lib_path('local-rack') do |s|
        s.write "lib/rack.rb", "puts :LOCAL"
      end

      install_gemfile <<-G
        source "file://#{gem_repo1}"
        gem "rack", :svn => "file://#{lib_path('rack-0.8')}", :branch => "master"
      G

      bundle %|config local.rack #{File.join(lib_path('local-rack'), '.checkout')}|
      bundle "update rack"
      expect(out).to include("Bundle updated!")
    end

    it "shows the previous version of the gem" do
      build_svn "rails", "3.0", :path => lib_path("rails")

      install_gemfile <<-G
        gem "rails", :svn => "file://#{lib_path('rails')}"
      G

      lockfile <<-G
        SVN
          remote: file://#{lib_path("rails")}
          specs:
            rails (2.3.2)

        PLATFORMS
          #{generic(Gem::Platform.local)}

        DEPENDENCIES
          rails!
      G

      bundle "update"
      expect(out).to include("Using rails 3.0 (was 2.3.2) from file://#{lib_path('rails')} (at HEAD)")
    end
  end
end