-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathrakefile
More file actions
59 lines (42 loc) · 1.28 KB
/
rakefile
File metadata and controls
59 lines (42 loc) · 1.28 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
47
48
49
50
51
52
53
54
55
56
57
58
# Used to run your rake tasks (rake db:seed & rake test:[acceptance|models|routes])
# Use bundler to load gems
require 'bundler'
# Load gems from Gemfile
Bundler.require
# Rake tasks for database management
namespace :db do
# Task for populating the database from db/seed.rb
# rake db:seed
task :seed do
# Load all models etc
require_relative 'config/environment'
# Update the database schema
DataMapper.auto_migrate!
# Add seed data to database
require './db/seed'
Seeder.seed!
end
end
# Rake tasks for running tests
namespace :test do
begin
# Load rspec module for creating rspec rake tasks
require 'rspec/core/rake_task'
# Acceptance tests (simulating or running a browser to inspect output)
# rake test:acceptance
RSpec::Core::RakeTask.new(:acceptance) do |t|
t.pattern = ['test/acceptance/*_spec.rb']
end
# Model tests (making sure models behave as expected)
# rake test:models
RSpec::Core::RakeTask.new(:models) do |t|
t.pattern = ['test/models/*_test.rb']
end
# Route tests (making sure routes respond as expected)
# rake test:routes
RSpec::Core::RakeTask.new(:routes) do |t|
t.pattern = ['test/routes/*_test.rb']
end
rescue LoadError #if rspec is not available (i.e environment is not test)
end
end