summaryrefslogtreecommitdiff
path: root/spec/support/rake_helpers.rb
blob: 86bfeed107c1725c96a01a7a28b2976fb52a1abd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module RakeHelpers
  def run_rake_task(task_name, *args)
    Rake::Task[task_name].reenable
    Rake.application.invoke_task("#{task_name}[#{args.join(',')}]")
  end

  def stub_warn_user_is_not_gitlab
    allow(main_object).to receive(:warn_user_is_not_gitlab)
  end

  def silence_output
    allow(main_object).to receive(:puts)
    allow(main_object).to receive(:print)
  end

  def main_object
    @main_object ||= TOPLEVEL_BINDING.eval('self')
  end
end