forked from honeycombio/beeline-ruby
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
65 lines (51 loc) · 1.42 KB
/
Rakefile
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
require 'active_record'
require 'bump/tasks'
require 'rspec/core/rake_task'
require 'yaml'
require 'yard'
$db_dir = 'spec/db'
YARD::Rake::YardocTask.new(:doc)
namespace :spec do
namespace :db do
include ActiveRecord::Tasks
task :config do
db_config = YAML.load_file("#$db_dir/config-activerecord.yml")
DatabaseTasks.database_configuration = db_config
DatabaseTasks.env = 'test'
DatabaseTasks.root = 'spec'
DatabaseTasks.db_dir = $db_dir
ActiveRecord::Base.configurations = db_config
end
desc 'Create the test database'
task create: :config do
DatabaseTasks.create_current
end
desc 'Delete the test database'
task drop: :config do
DatabaseTasks.drop_current
end
desc 'Set up the test database from schema.rb'
task load_schema: :config do
DatabaseTasks.load_schema_current(:ruby, nil)
end
end
TEST_APPS = %i(
sinatra_activerecord
sinatra_sequel
rails_activerecord
)
TEST_APPS.each do |app|
desc "Run specs for #{app} test app"
RSpec::Core::RakeTask.new(app) do |t|
t.rspec_opts = "--pattern spec/instrumented_apps/#{app}/**/*_spec.rb"
end
end
desc 'Run specs for Beeline operation'
RSpec::Core::RakeTask.new(:beeline) do |t|
t.rspec_opts = '--pattern spec/beeline/**/*_spec.rb'
end
task all: TEST_APPS + [:beeline]
end
desc 'Run all specs'
task spec: 'spec:all'
task default: :spec