summaryrefslogtreecommitdiff
path: root/spec/other/config_spec.rb
blob: bb4cd9e0e6a9bcf403d7bfcc4a66f800cce9212f (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
require "spec_helper"

describe ".bundle/config" do
  before :each do
    gemfile <<-G
      source "file://#{gem_repo1}"
      gem "rack", "1.0.0"
    G
  end

  it "can be moved with an environment variable" do
    env['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
    bundle "install vendor"

    bundled_app('.bundle').should_not exist
    tmp('foo/bar/config').should exist
    should_be_installed "rack 1.0.0"
  end

  it "can provide a relative path with the environment variable" do
    FileUtils.mkdir_p bundled_app('omg')
    Dir.chdir bundled_app('omg')

    env['BUNDLE_APP_CONFIG'] = "../foo"
    bundle "install vendor"

    bundled_app(".bundle").should_not exist
    bundled_app("../foo/config").should exist
    should_be_installed "rack 1.0.0"
  end

  it "removes environment.rb from BUNDLE_APP_CONFIG's path" do
    FileUtils.mkdir_p(tmp('foo/bar'))
    env['BUNDLE_APP_CONFIG'] = tmp('foo/bar').to_s
    bundle "install"
    FileUtils.touch tmp('foo/bar/environment.rb')
    should_be_installed "rack 1.0.0"
    tmp('foo/bar/environment.rb').should_not exist
  end
end