-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
46 lines (35 loc) · 1.11 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
require 'bundler/setup'
require "bundler/gem_tasks"
require 'rspec/core/rake_task'
desc "Run specs"
RSpec::Core::RakeTask.new :spec => ['spec:prepare'] do |t|
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
# Put spec opts in a file named .rspec in root
end
namespace :spec do
desc 'Create spec'
task :create, :path do |t, args|
spec_path = File.join('spec', args[:path].gsub(%r{.rb$}, '_spec.rb'))
klass = File.basename(args[:path], File.extname(args[:path])).split('_').map {|s| "#{s[0,1].upcase}#{s[1..-1]}" }.join
mkdir_p File.dirname(spec_path)
spec_doc = <<-EOS
require 'spec_helper'
describe #{klass} do
end
EOS
File.open(spec_path, 'w+') do |f|
f.puts spec_doc
end
puts spec_doc
end
task :prepare => ['db:migrate:reset', 'db:test:prepare']
end
ENV["RAILS_ENV"] ||= 'test'
require 'flash_s3_test/config/application'
FlashS3Test::Application.load_tasks
task :server => 'db:migrate:reset' do
app = Rack::Builder.new { run FlashS3Test::Application }.to_app
Rack::Handler::Thin.run app, :Port => 3000
end
desc 'Default: run specs.'
task :default => :spec