-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathspec_helper.rb
49 lines (42 loc) · 1.32 KB
/
spec_helper.rb
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
$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'bravo'
require 'rspec'
require 'vcr'
if ENV['TRAVIS']
require 'simplecov'
SimpleCov.start
end
begin
require 'debugger'
rescue LoadError
end
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :fakeweb
c.configure_rspec_metadata!
end
RSpec.configure do |config|
config.treat_symbols_as_metadata_keys_with_true_values = true
config.filter_run :focus => true
config.run_all_when_everything_filtered = true
end
Bravo.pkey = 'spec/fixtures/certs/pkey'
Bravo.cert = 'spec/fixtures/certs/cert.crt'
Bravo.cuit = ENV['CUIT'] || '20287740027'
Bravo.sale_point = ENV['SALE'] || '0002'
Bravo.default_concepto = 'Productos y Servicios'
Bravo.default_documento = 'CUIT'
Bravo.default_moneda = :peso
Bravo.own_iva_cond = :responsable_inscripto
Bravo.logger = { log: ENV['BRAVO_LOG'] == 'true' }
Bravo.openssl_bin = ENV['OPENSSL_PATH']
Bravo::AuthData.environment = :test
# TODO: refactor into actual validations
unless Bravo.cuit
raise(Bravo::NullOrInvalidAttribute.new, 'Please set CUIT env variable.')
end
[Bravo.pkey, Bravo.cert].each do |file|
unless File.exists?("#{ file }")
raise(Bravo::MissingCertificate.new, "No existe #{ file }")
end
end