-
Notifications
You must be signed in to change notification settings - Fork 195
/
Rakefile
63 lines (52 loc) · 1.75 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
require "rubygems"
require "rspec/core/rake_task"
task :default => "test:all"
task :dev_console do
sh "irb -I lib -rubygems -r braintree -r env/development"
end
task :lint do
puts "Running rubocop for linting, you can autocorrect by running `rubocop -a`"
sh "rubocop"
end
namespace :test do
# Usage:
# rake test:unit
# rake test:unit[configuration_spec]
# rake test:unit[configuration_spec,"accepts merchant credentials"]
desc "Run unit tests"
task :unit, [:file_name, :test_name] => [:lint] do |_task, args|
if args.file_name.nil?
sh "rspec --pattern spec/unit/**/*_spec.rb"
elsif args.test_name.nil?
sh "rspec --pattern spec/unit/**/#{args.file_name}.rb --format documentation --color"
else
sh "rspec --pattern spec/unit/**/#{args.file_name}.rb --example '#{args.test_name}' --format documentation --color"
end
end
# Usage:
# rake test:integration
# rake test:integration[plan_spec]
# rake test:integration[plan_spec,"gets all plans"]
desc "Run integration tests"
task :integration, [:file_name, :test_name] => [:lint] do |_task, args|
if args.file_name.nil?
sh "rspec --pattern spec/integration/**/*_spec.rb"
elsif args.test_name.nil?
sh "rspec --pattern spec/integration/**/#{args.file_name}.rb --format documentation --color"
else
sh "rspec --pattern spec/integration/**/#{args.file_name}.rb --example '#{args.test_name}' --format documentation --color"
end
end
task :all => [:unit, :integration]
end
task :test => "test:all"
task :gem do
exec("gem build braintree.gemspec")
end
require File.dirname(__FILE__) + "/lib/braintree/configuration.rb"
desc "Cleans generated files"
task :clean do
rm_f Dir.glob("*.gem").join(" ")
rm_rf "rdoc"
rm_rf "bt_rdoc"
end