blob: 07d92fb6cf8f80d57a782b9184b1f8935fdb5092 (
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
|
require "spec_helper"
describe "bundle lock" do
def strip_lockfile(lockfile)
strip_whitespace(lockfile).sub(/\n\Z/, '')
end
def read_lockfile(file = "Gemfile.lock")
strip_lockfile bundled_app(file).read
end
before :each do
gemfile <<-G
source "file://#{gem_repo1}"
gem "rails"
gem "with_license"
gem "foo"
G
@lockfile = strip_lockfile <<-L
GEM
remote: file:#{gem_repo1}/
specs:
actionmailer (2.3.2)
activesupport (= 2.3.2)
actionpack (2.3.2)
activesupport (= 2.3.2)
activerecord (2.3.2)
activesupport (= 2.3.2)
activeresource (2.3.2)
activesupport (= 2.3.2)
activesupport (2.3.2)
foo (1.0)
rails (2.3.2)
actionmailer (= 2.3.2)
actionpack (= 2.3.2)
activerecord (= 2.3.2)
activeresource (= 2.3.2)
rake (= 10.0.2)
rake (10.0.2)
with_license (1.0)
PLATFORMS
ruby
DEPENDENCIES
foo
rails
with_license
BUNDLED WITH
#{Bundler::VERSION}
L
end
it "prints a lockfile when there is no existing lockfile with --print" do
bundle "lock --print"
expect(out).to eq(@lockfile)
end
it "prints a lockfile when there is an existing lockfile with --print" do
lockfile @lockfile
bundle "lock --print"
expect(out).to eq(@lockfile)
end
it "writes a lockfile when there is no existing lockfile" do
bundle "lock"
expect(read_lockfile).to eq(@lockfile)
end
it "writes a lockfile when there is an outdated lockfile using --update" do
lockfile @lockfile.gsub('2.3.2', '2.3.1')
bundle "lock --update"
expect(read_lockfile).to eq(@lockfile)
end
it "does not fetch remote specs when using the --local option" do
bundle "lock --update --local"
expect(out).to include("available on this machine.")
end
it "writes to a custom location using --lockfile" do
bundle "lock --lockfile=lock"
expect(out).to match(/Writing lockfile to.+lock/)
expect(read_lockfile "lock").to eq(@lockfile)
expect { read_lockfile }.to raise_error
end
end
|