2018-11-02 19:07:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-04-14 02:05:27 -04:00
|
|
|
RSpec.describe "require 'bundler/gem_tasks'" do
|
2018-11-02 19:07:56 -04:00
|
|
|
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
|
2019-06-01 05:49:40 -04:00
|
|
|
sys_exec "#{rake} -T", "RUBYOPT" => "-I#{bundler_path}"
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
|
2019-06-01 05:49:40 -04:00
|
|
|
expect(err).to eq("")
|
2018-11-02 19:07:56 -04:00
|
|
|
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
|
2018-11-11 19:53:15 -05:00
|
|
|
sys_exec! %(#{rake} -e 'load "Rakefile"; puts CLOBBER.inspect')
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
2019-06-01 05:49:40 -04:00
|
|
|
expect(out).to eq '["pkg"]'
|
2018-11-02 19:07:56 -04:00
|
|
|
end
|
|
|
|
end
|