-
Notifications
You must be signed in to change notification settings - Fork 104
/
Rakefile
47 lines (41 loc) · 1.33 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
task :default => %w[test:unit test:integration]
task :test => %w[test:unit test:integration]
task :lint => [:npm_install] do
sh "npm run lint"
end
namespace :test do
# Usage:
# rake test:unit
# rake test:unit[config_spec]
# rake test:unit[config_spec,"can be configured with merchant credentials"]
desc "Run unit tests"
task :unit, [:file_name, :test_name] => [:lint] do |task, args|
if args.file_name.nil?
sh "npm test"
elsif args.test_name.nil?
sh "#{mocha} test/unit/braintree/#{args.file_name}.js"
else
sh "#{mocha} -g '#{args.test_name}' test/unit/braintree/#{args.file_name}.js"
end
end
# Usage:
# rake test:integration
# rake test:integration[plan_gateway_spec]
# rake test:integration[plan_gateway_spec,"gets all plans"]
desc "Run integration tests"
task :integration, [:file_name, :test_name] => [:lint] do |task, args|
if args.file_name.nil?
sh "npm run test:integration"
elsif args.test_name.nil?
sh "#{mocha} --slow 2000 test/integration/braintree/#{args.file_name}.js"
else
sh "#{mocha} --slow 2000 -g '#{args.test_name}' test/integration/braintree/#{args.file_name}.js"
end
end
end
task :npm_install do
sh "npm install --force"
end
def mocha
"./node_modules/mocha/bin/mocha --timeout 62000 --reporter spec -r test/spec_helper"
end