rake_helpers.rb 596 字节
Newer Older
1
module RakeHelpers
R
Rémy Coutable 已提交
2
  def run_rake_task(task_name, *args)
3
    Rake::Task[task_name].reenable
R
Rémy Coutable 已提交
4
    Rake.application.invoke_task("#{task_name}[#{args.join(',')}]")
5 6 7
  end

  def stub_warn_user_is_not_gitlab
8
    allow(main_object).to receive(:warn_user_is_not_gitlab)
9
  end
G
Gabriel Mazetto 已提交
10 11

  def silence_output
12 13 14 15
    allow(main_object).to receive(:puts)
    allow(main_object).to receive(:print)
  end

16 17 18 19
  def silence_progress_bar
    allow_any_instance_of(ProgressBar::Output).to receive(:stream).and_return(double().as_null_object)
  end

20 21
  def main_object
    @main_object ||= TOPLEVEL_BINDING.eval('self')
G
Gabriel Mazetto 已提交
22
  end
23
end