-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
46 lines (40 loc) · 1.24 KB
/
Rakefile
File metadata and controls
46 lines (40 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
desc 'Default: run unit tests.'
task :default => [:clean_db, :test]
desc 'Remove the stale db file'
task :clean_db do
`rm -f #{File.dirname(__FILE__)}/test/encrypted_attrs.sqlite3.db`
end
desc 'Test the has_encrypted_attributes plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = true
end
namespace :test do
desc 'Run the tests under ruby-prof'
task :profile => [ :enable_test_profiling, :test ]
task(:enable_test_profiling) do
rm_f 'profile'
mkpath 'profile'
ENV['ENABLE_TEST_PROFILING'] = 'yep'
end
end
desc 'Generate documentation for the has_encrypted_attributes plugin.'
Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'HasEncryptedAttributes'
rdoc.options << '--line-numbers' << '--inline-source'
rdoc.rdoc_files.include('README')
rdoc.rdoc_files.include('lib/**/*.rb')
end
desc 'Measures test coverage using rcov'
task :rcov do
rm_f "coverage"
mkpath "coverage"
rcov = "rcov --rails --aggregate coverage/aggregate.data -Ilib -x/Library"
system("#{rcov} --html #{Dir.glob('test/**/*_test.rb').join(' ')}")
system("open coverage/index.html") if PLATFORM['darwin']
end