summaryrefslogtreecommitdiff
path: root/spec/runtime/executable_spec.rb
blob: e604682768abb554d613a8cc3c6a67a97e9ed3a8 (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
require "spec_helper"

describe "Running bin/* commands" do
  it "runs the bundled command when in the bundle" do
    install_gemfile <<-G
      source "file://#{gem_repo1}"
      gem "rack"
    G

    build_gem "rack", "2.0", :to_system => true do |s|
      s.executables = "rackup"
    end

    gembin "rackup"
    out.should == "1.0.0"
  end

  it "runs the bundled command when out of the bundle" do
    install_gemfile <<-G
      source "file://#{gem_repo1}"
      gem "rack"
    G

    build_gem "rack", "2.0", :to_system => true do |s|
      s.executables = "rackup"
    end

    Dir.chdir(tmp) do
      gembin "rackup"
      out.should == "1.0.0"
    end
  end

  it "works with gems in path" do
    build_lib "rack", :path => lib_path("rack") do |s|
      s.executables = 'rackup'
    end

    install_gemfile <<-G
      gem "rack", :path => "#{lib_path('rack')}"
    G

    build_gem 'rack', '2.0', :to_system => true do |s|
      s.executables = 'rackup'
    end

    gembin "rackup"
    out.should == '1.0'
  end

  it "don't bundle da bundla" do
    build_gem "bundler", Bundler::VERSION, :to_system => true do |s|
      s.executables = "bundle"
    end

    install_gemfile <<-G
      source "file://#{gem_repo1}"
      gem "bundler"
    G

    bundled_app("bin/bundle").should_not exist
  end
end