diff options
author | Dennis Suratna <dennis.suratna@gmail.com> | 2017-03-06 16:36:38 -0800 |
---|---|---|
committer | Dennis Suratna <dennis.suratna@gmail.com> | 2017-04-11 18:33:28 +0700 |
commit | cebcfee68f9814bb39eb8317756fa3f00b10591a (patch) | |
tree | 9ea5e21a69c12c08b76e7aa8116cafaff72c3bdc | |
parent | 37c4528239089ef123cd20b9e2c2975d5cce9074 (diff) | |
download | bundler-cebcfee68f9814bb39eb8317756fa3f00b10591a.tar.gz |
Initial pristine specs
-rw-r--r-- | spec/commands/pristine_spec.rb | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/spec/commands/pristine_spec.rb b/spec/commands/pristine_spec.rb new file mode 100644 index 0000000000..0a546a14a6 --- /dev/null +++ b/spec/commands/pristine_spec.rb @@ -0,0 +1,50 @@ +# frozen_string_literal: true +require "spec_helper" +require "fileutils" + +RSpec.describe "bundle pristine" do + before :each do + build_repo2 do + build_gem "weakling" + build_git "foo", :path => lib_path("foo") + build_lib "bar", :path => lib_path("foo") + end + + install_gemfile <<-G + source "file://#{gem_repo2}" + gem "weakling" + gem "foo", :git => "#{lib_path("foo")}" + gem "bar", :path => "#{lib_path("foo")}" + G + + bundle "install" + end + + it "reverts gem sourced from Rubygems to its cached .gem file" do + + spec = Bundler.definition.specs["weakling"].first + changes_txt = "#{spec.full_gem_path}/lib/changes.txt" + expect(File.exist?(changes_txt)).to be_falsey + expect(File.exist?(spec.cache_file)).to be_truthy + + FileUtils.touch(changes_txt) + + expect(File.exist?(changes_txt)).to be_truthy + + bundle "pristine" + + expect(File.exist?(changes_txt)).to be_falsey + end + + it "reverts gem sourced from Git by issuing `git checkout --force`" do + + spec = Bundler.definition.specs["foo"].first + + end + + it "ignores gem sourced from local path" do + + spec = Bundler.definition.specs["bar"].first + + end +end |