aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/runtime/gem_tasks_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/bundler/runtime/gem_tasks_spec.rb')
-rw-r--r--spec/bundler/runtime/gem_tasks_spec.rb44
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/bundler/runtime/gem_tasks_spec.rb b/spec/bundler/runtime/gem_tasks_spec.rb
new file mode 100644
index 0000000000..0510c80632
--- /dev/null
+++ b/spec/bundler/runtime/gem_tasks_spec.rb
@@ -0,0 +1,44 @@
+# frozen_string_literal: true
+
+RSpec.describe "require 'bundler/gem_tasks'", :ruby_repo do
+ before :each do
+ bundled_app("foo.gemspec").open("w") do |f|
+ f.write <<-GEMSPEC
+ Gem::Specification.new do |s|
+ s.name = "foo"
+ end
+ GEMSPEC
+ end
+ bundled_app("Rakefile").open("w") do |f|
+ f.write <<-RAKEFILE
+ $:.unshift("#{bundler_path}")
+ require "bundler/gem_tasks"
+ RAKEFILE
+ end
+ end
+
+ it "includes the relevant tasks" do
+ with_gem_path_as(Spec::Path.base_system_gems.to_s) do
+ sys_exec "ruby -S rake -T"
+ end
+
+ expect(err).to eq("")
+ expected_tasks = [
+ "rake build",
+ "rake clean",
+ "rake clobber",
+ "rake install",
+ "rake release[remote]",
+ ]
+ tasks = out.lines.to_a.map {|s| s.split("#").first.strip }
+ expect(tasks & expected_tasks).to eq(expected_tasks)
+ expect(exitstatus).to eq(0) if exitstatus
+ end
+
+ it "adds 'pkg' to rake/clean's CLOBBER" do
+ with_gem_path_as(Spec::Path.base_system_gems.to_s) do
+ sys_exec! %('#{Gem.ruby}' -S rake -e 'load "Rakefile"; puts CLOBBER.inspect')
+ end
+ expect(last_command.stdout).to eq '["pkg"]'
+ end
+end