Sha256: aec9c017c844617e79c0da1cf8d16d15075500deb2744d7e3c448886d44b647e
Contents?: true
Size: 1.6 KB
Versions: 4
Compression:
Stored size: 1.6 KB
Contents
# A test harness for RakeHandler # require 'rake' require 'rubygems' require 'projectlocker_errata' require 'projectlocker_errata/rake_handler' ProjectlockerErrata.configure do |c| end # Should catch exception task :projectlocker_errata do ProjectlockerErrata.configuration.rescue_rake_exceptions = true stub_tty_output(true) raise_exception end # Should not catch exception task :projectlocker_errata_disabled do ProjectlockerErrata.configuration.rescue_rake_exceptions = false stub_tty_output(true) raise_exception end # Should not catch exception as tty_output is true task :projectlocker_errata_autodetect_from_terminal do ProjectlockerErrata.configuration.rescue_rake_exceptions = nil stub_tty_output(true) raise_exception end # Should catch exception as tty_output is false task :projectlocker_errata_autodetect_not_from_terminal do ProjectlockerErrata.configuration.rescue_rake_exceptions = nil stub_tty_output(false) raise_exception end task :projectlocker_errata_not_yet_configured do ProjectlockerErrata.configuration.rescue_rake_exceptions = true stub_tty_output(true) stub_empty_sender raise_exception end module ProjectlockerErrata def self.notify_or_ignore(*args) # TODO if you need to check more params, you'll have to use json.dump or something $stderr.puts "projectlocker_errata #{args[1][:component]}" end end def stub_empty_sender ProjectlockerErrata.sender = nil end def stub_tty_output(value) Rake.application.instance_eval do @tty_output_stub = value def tty_output? @tty_output_stub end end end def raise_exception raise 'TEST' end
Version data entries
4 entries across 4 versions & 1 rubygems