This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
/
manifest_file_spec.rb
98 lines (82 loc) · 2.24 KB
/
manifest_file_spec.rb
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
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
describe "Bundler::Environment" do
before :each do
@manifest = simple_manifest
end
def simple_manifest(extra = nil)
build_manifest <<-Gemfile
clear_sources
source "file://#{gem_repo1}"
gem "rack"
#{extra}
Gemfile
end
def goto(where)
if where == :app
where = bundled_app
else
where = "#{bundled_app}/#{where}"
end
FileUtils.mkdir_p(where)
Dir.chdir(where)
end
def bundle
gem_command :bundle
end
def works
run_in_context("Bundler.require_env ; puts RACK").should == "1.0.0"
end
it "finds the default manifest file when it's in a parent directory" do
goto "wot"
bundle
works
end
it "sets the default bundle path to vendor/gems" do
@manifest.gem_path.should_not exist
goto :app
bundle
@manifest.gem_path.should exist
end
it "allows setting the bundle path in the manifest file" do
simple_manifest %[bundle_path "#{bundled_app('gems')}"]
goto :app
bundle
bundled_app('gems').should exist
end
it "assumes the bundle_path is relative to the manifest file no matter what the current working dir is" do
simple_manifest %[bundle_path File.join('..', 'cheezeburgerz')]
goto 'w0t'
bundle
tmp_path('cheezeburgerz').should exist
end
it "sets the default bindir relative to the Gemfile" do
goto 'wot'
bundle
bundled_app("bin/rackup").should exist
end
it "allows setting the bindir in the manifest file" do
simple_manifest %[bin_path "#{bundled_app('binz')}"]
goto :app
bundle
bundled_app('binz/rackup').should exist
end
it "assumes the bindir is relative to the manifest file no matter what the current working dir is" do
simple_manifest %[bin_path File.join('..', 'cheezeburgerz')]
goto 'w0t'
bundle
tmp_path('cheezeburgerz/rackup').should exist
end
it "overwrites existing bin files" do
bundled_app("bin/rackup").touch_p
goto :app
bundle
`#{bundled_app}/bin/rackup`.should == "1.0.0\n"
end
it "recreates the bin files if they are missing" do
goto :app
bundle
bundled_app('bin/rackup').delete
bundle
bundled_app('bin/rackup').should exist
end
end