Sha256: b0e3d70cd34607c0ceb498b2a20c4ea6b6bbe4bb9b58ea28a8b7dac364229d35
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
namespace :landable do namespace :pgtap do def pgprove? @has_prove ||= Kernel.system('which pg_prove > /dev/null') end def pgconfig? @has_pgconfig ||= Kernel.system('which pg_config > /dev/null') end def pgtap? has_pgtap = false if pgconfig? sharedir = "#{`pg_config | grep SHAREDIR | awk {' print $3 '}`.strip}/extension/pgtap.control" has_pgtap = true if File.file?("#{sharedir}") end has_pgtap end desc 'Run PGTap unit tests' task :run, [:test_file] => [:environment] do |_t, _args| if pgprove? && pgtap? # Load pgtap functions into database. Will not complain if already loaded. ActiveRecord::Base.connection.execute('CREATE EXTENSION IF NOT EXISTS pgtap;') # Runs the tests. Wrapped pg_prove call in shell script due to issues with return values sh "cd #{Rails.root}/../../script && ./pgtap" else puts "\nPGTap and/or pg_prove not installed. Skipping DB unit tests" puts "Reference 'http://pgtap.org/documentation.html#installation' for installation instructions." end end end task pgtap: 'pgtap:run' end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
landable-1.14.0 | lib/tasks/landable/pgtap.rake |
landable-1.13.2 | lib/tasks/landable/pgtap.rake |