-
Notifications
You must be signed in to change notification settings - Fork 346
/
Rakefile
49 lines (45 loc) · 1.43 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
#!/usr/bin/env rake
begin
require 'bundler/setup'
require 'appraisal'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
namespace :spec do
RSpec::Core::RakeTask.new(:unit) do |spec|
spec.pattern = 'spec/unit/*_spec.rb'
spec.rspec_opts = ['--backtrace']
rbx = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
if RUBY_VERSION == '1.8.7' && !(rbx || jruby)
spec.rcov = true
spec.rcov_opts = %w{--exclude gems\/,spec\/}
end
end
RSpec::Core::RakeTask.new(:integration) do |spec|
spec.pattern = 'spec/integration/*_spec.rb'
spec.rspec_opts = ['--backtrace']
end
desc "run spec:unit and spec:integration tasks"
task :all do
Rake::Task['spec:unit'].execute
# Travis CI does not expose encrypted ENV variables for pull requests, so
# do not run integration specs
# http://about.travis-ci.org/docs/user/build-configuration/#Set-environment-variables
#
pull_request = ENV['TRAVIS_PULL_REQUEST'] == 'true'
ci_build = ENV['TRAVIS'] == 'true'
if !ci_build || (ci_build && pull_request)
Rake::Task['spec:integration'].execute
end
end
end
if !ENV["APPRAISAL_INITIALIZED"] && !ENV["TRAVIS"]
task :default do
sh "appraisal install && rake appraisal spec:unit"
end
else
task default: ["spec:unit"]
end