diff options
author | Andre Arko <andre@arko.net> | 2010-03-24 11:07:00 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-03-24 11:07:29 -0700 |
commit | 7147a13b01e8943d28d38814521fc7343d7d479f (patch) | |
tree | da5051c71aa60805557dcd68848ec40719593936 /spec | |
parent | 426a85ceca1b2bca0c610fb8bb996984e97fe6fe (diff) | |
download | bundler-7147a13b01e8943d28d38814521fc7343d7d479f.tar.gz |
Include executables in virtual gemspecs
- Add tests for gem binaries when locked and unlocked:
- with :path
- with :git
- with :git and no gemspec
- Add should_be_locked matcher
Diffstat (limited to 'spec')
-rw-r--r-- | spec/other/exec_spec.rb | 104 | ||||
-rw-r--r-- | spec/runtime/environment_rb_spec.rb | 6 | ||||
-rw-r--r-- | spec/support/matchers.rb | 4 |
3 files changed, 93 insertions, 21 deletions
diff --git a/spec/other/exec_spec.rb b/spec/other/exec_spec.rb index 490c2852b1..2102598566 100644 --- a/spec/other/exec_spec.rb +++ b/spec/other/exec_spec.rb @@ -85,36 +85,106 @@ describe "bundle exec" do G bundle "lock" + should_be_locked File.open(".bundle/environment.rb", 'a') { |f| f.puts "puts 'using environment.rb'" } bundle "exec rackup" out.should == "using environment.rb\n1.0.0" end + end - it "works when running from a random directory" do - install_gemfile <<-G - gem "rack" - G + describe "with gem binaries" do + describe "run from a random directory" do + before(:each) do + install_gemfile <<-G + gem "rack" + G + end - bundle "lock" - bundle "exec 'cd #{tmp('gems')} && rackup'" + it "works when unlocked" do + bundle "exec 'cd #{tmp('gems')} && rackup'" + out.should == "1.0.0" + end - out.should == "1.0.0" + it "works when locked" do + bundle "lock" + should_be_locked + bundle "exec 'cd #{tmp('gems')} && rackup'" + out.should == "1.0.0" + end end - it "works with gems from a path" do - build_lib "fizz", :path => home("fizz") do |s| - s.executables = "fizz" + describe "from gems bundled via :path" do + before(:each) do + build_lib "fizz", :path => home("fizz") do |s| + s.executables = "fizz" + end + + install_gemfile <<-G + gem "fizz", :path => "#{File.expand_path(home("fizz"))}" + G end - install_gemfile <<-G - gem "fizz", :path => "#{File.expand_path(home("fizz"))}" - G + it "works when unlocked" do + bundle "exec fizz" + out.should == "1.0" + end - bundle "lock" - bundle "exec fizz" - out.should == "1.0" + it "works when locked" do + bundle "lock" + should_be_locked + bundle "exec fizz" + out.should == "1.0" + end end - end + describe "from gems bundled via :git" do + before(:each) do + build_git "fizz_git" do |s| + s.executables = "fizz_git" + end + + install_gemfile <<-G + gem "fizz_git", :git => "#{lib_path('fizz_git-1.0')}" + G + end + + it "works when unlocked" do + bundle "exec fizz_git" + out.should == "1.0" + end + + it "works when locked" do + bundle "lock" + should_be_locked + bundle "exec fizz_git" + out.should == "1.0" + end + end + + describe "from gems bundled via :git with no gemspec" do + before(:each) do + build_git "fizz_no_gemspec", :gemspec => false do |s| + s.executables = "fizz_no_gemspec" + end + + install_gemfile <<-G + gem "fizz_no_gemspec", "1.0", :git => "#{lib_path('fizz_no_gemspec-1.0')}" + G + end + + it "works when unlocked" do + bundle "exec fizz_no_gemspec" + out.should == "1.0" + end + + it "works when locked" do + bundle "lock" + should_be_locked + bundle "exec fizz_no_gemspec" + out.should == "1.0" + end + end + + end end
\ No newline at end of file diff --git a/spec/runtime/environment_rb_spec.rb b/spec/runtime/environment_rb_spec.rb index 446ffe41eb..f9395f2f3b 100644 --- a/spec/runtime/environment_rb_spec.rb +++ b/spec/runtime/environment_rb_spec.rb @@ -7,15 +7,13 @@ describe "environment.rb file" do build_git "no-gemspec", :gemspec => false install_gemfile <<-G - source "file://#{gem_repo1}" - - gem "no-gemspec", '1.0', :git => "#{lib_path('no-gemspec-1.0')}" + gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}" G bundle :lock end - it "works with gems from git that don't have gemspecs" do + it "loads the library via a virtual spec" do run <<-R, :lite_runtime => true require 'no-gemspec' puts NOGEMSPEC diff --git a/spec/support/matchers.rb b/spec/support/matchers.rb index 5e28ac7777..478cd7b81a 100644 --- a/spec/support/matchers.rb +++ b/spec/support/matchers.rb @@ -43,5 +43,9 @@ module Spec out.should == "WIN" || Gem::Version.new(out).should_not == Gem::Version.new(version) end end + + def should_be_locked + Pathname.new(".bundle/environment.rb").should exist + end end end
\ No newline at end of file |