-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
40 lines (34 loc) · 1.07 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
require "bundler/gem_tasks"
require "rspec/core/rake_task"
RSpec::Core::RakeTask.new(:spec)
task :default => :setup_and_run_tests
desc 'Setup and run all tests'
task :setup_and_run_tests do
unless File.exist?('dummy/config/environment.rb')
Rake::Task[:dummy_generate].invoke
open('dummy/Gemfile', 'a') { |f|
f.puts "gem 'acts_as_ocenieable', path: '../../'"
}
system('cd dummy && bundle install')
end
Rake::Task[:dummy_copy_fixtures].invoke
system('bundle exec rspec')
end
desc 'Generate dummy application for test cases'
task :dummy_generate do
Rake::Task[:dummy_remove].invoke
puts 'Creating dummy application to run tests'
system('rails new dummy --database=sqlite3')
FileUtils.rm_r Dir.glob('dummy/test/*')
end
desc 'Copy Files to dummy application'
task :dummy_copy_fixtures do
dummy_path = 'dummy'
FileUtils.cp_r 'spec/fixtures/app', dummy_path
FileUtils.cp_r 'spec/fixtures/config', dummy_path
FileUtils.cp_r 'spec/fixtures/db', dummy_path
end
desc 'Remove dummy application'
task :dummy_remove do
FileUtils.rm_r Dir.glob('dummy/')
end