diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/bundler/git_spec.rb | 36 | ||||
-rw-r--r-- | spec/support/helpers.rb | 13 |
2 files changed, 49 insertions, 0 deletions
diff --git a/spec/bundler/git_spec.rb b/spec/bundler/git_spec.rb new file mode 100644 index 0000000000..14b6ba1fb4 --- /dev/null +++ b/spec/bundler/git_spec.rb @@ -0,0 +1,36 @@ +require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') + +describe "Getting gems from git" do + + before(:each) do + path = build_git_repo :very_simple, :with => fixture_dir.join("very-simple") + install_manifest <<-Gemfile + clear_sources + source "file://#{gem_repo1}" + gem "very-simple", "1.0", :git => "#{path}" + Gemfile + end + + it "does not download the gem" do + tmp_gem_path.should_not include_cached_gem("very-simple-1.0") + tmp_gem_path.should_not include_installed_gem("very-simple-1.0") + end + + it "clones the git repository" do + tmp_gem_path("dirs", "dirs", "very-simple").should be_directory + end + + it "has very-simple in the load path" do + out = run_in_context "require 'very-simple' ; puts VerySimpleForTests" + out.should == "VerySimpleForTests" + end + + it "removes the directory during cleanup" do + install_manifest <<-Gemfile + clear_sources + source "file://#{gem_repo1}" + Gemfile + + tmp_gem_path("dirs", "very-simple").should_not be_directory + end +end
\ No newline at end of file diff --git a/spec/support/helpers.rb b/spec/support/helpers.rb index 86ffb13cec..469b1beb7a 100644 --- a/spec/support/helpers.rb +++ b/spec/support/helpers.rb @@ -43,6 +43,19 @@ module Spec m end + def build_git_repo(name, options = {}) + with = options[:with] or raise "Omg, need to specify :with" + path = tmp_path.join("git", name.to_s) + path.parent.mkdir_p + with.cp_r(path) + Dir.chdir(path) do + `git init` + `git add *` + `git commit -m "OMG GITZ"` + end + path + end + def reset! tmp_path.rmtree if tmp_path.exist? tmp_path.mkdir |