forked from trh/to_factory
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
40 lines (33 loc) · 925 Bytes
/
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
require "bundler/gem_tasks"
namespace :spec do
def setup_db
require "logger"
require "active_record"
ActiveRecord::Base.establish_connection(adapter: "sqlite3", database: "spec/db/test.sqlite3")
ActiveRecord::Base.logger = Logger.new(File.open("tmp/database.log", "a"))
end
desc "Migrate the database through scripts in db/migrate. Target specific version with VERSION=x"
task :migrate_db do
setup_db
ActiveRecord::Migrator.migrate("spec/db/migrate")
end
desc "Migrate down"
task :migrate_down do
setup_db
ActiveRecord::Migrator.down("spec/db/migrate")
end
end
begin
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new do |t|
t.rspec_opts = ["-c", "-f progress", "-r ./spec/spec_helper.rb"]
t.pattern = "spec/**/*_spec.rb"
end
task default: :spec
rescue LoadError
end
begin
require "rubocop/rake_task"
RuboCop::RakeTask.new
rescue LoadError
end