Sha256: 2e5087c5b7246b2143ee6ed3a6561a92249d49d0376cf2a4df80e37c1f004b89
Contents?: true
Size: 820 Bytes
Versions: 1
Compression:
Stored size: 820 Bytes
Contents
namespace :landable do namespace :pgtap do def has_pgprove? @@has_prove ||= Kernel.system('which pg_prove > /dev/null') end desc "Run PGTap unit tests" task :run, [:test_file] => [ :environment ] do |t, args| dbdir = "#{Rails.root}/../../db" tests = args[:test_file] ? args[:test_file] : "*.sql" if not has_pgprove? puts "\nPGTap not installed. Skipping DB unit tests" puts "Reference 'http://pgtap.org/documentation.html#installation' for installation instructions." else # Load pgtap functions into database. Will not complain if already loaded. ActiveRecord::Base.connection.execute(IO.read("#{dbdir}/pgtap/pgtap.sql")) sh "cd #{Rails.root}/../../script && ./pgtap" end end end task :pgtap => 'pgtap:run' end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
landable-1.8.0 | lib/tasks/landable/pgtap.rake |