aboutsummaryrefslogtreecommitdiffstats
path: root/spec/runtime
diff options
context:
space:
mode:
authorCarl Lerche <carllerche@mac.com>2010-05-09 00:23:54 +0300
committerCarl Lerche <carllerche@mac.com>2010-05-09 00:23:54 +0300
commit5f26a035a498681dcadf31c7711dc862508ade93 (patch)
treeea830fbf97dcc7ee6b522e0e514171d8bb0a7f92 /spec/runtime
parentcd8a5638e04c73216229d07e6ae0af13202cd08f (diff)
downloadbundler-5f26a035a498681dcadf31c7711dc862508ade93.tar.gz
Have bundler generate executable stubs into ~/.bundler/bin that will automatically call bundler/setup if in bundle directory
Diffstat (limited to 'spec/runtime')
-rw-r--r--spec/runtime/executable_spec.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/spec/runtime/executable_spec.rb b/spec/runtime/executable_spec.rb
new file mode 100644
index 00000000..c0874529
--- /dev/null
+++ b/spec/runtime/executable_spec.rb
@@ -0,0 +1,69 @@
+require "spec_helper"
+
+describe "Running 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 system 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 == "2.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 "blows up when running outside of the directory" 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
+
+ Dir.chdir(tmp) do
+ gembin "rackup"
+ out.should == '2.0'
+ end
+ end
+end \ No newline at end of file