add test with travis
This commit is contained in:
parent
0c93fd9eea
commit
59e850cfeb
11 changed files with 192 additions and 269 deletions
test
40
test/test_config.rb
Normal file
40
test/test_config.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
#!/usr/bin/ruby
|
||||
|
||||
require 'mpw/config'
|
||||
require 'test/unit'
|
||||
require 'locale'
|
||||
require 'i18n'
|
||||
|
||||
class TestConfig < Test::Unit::TestCase
|
||||
def setup
|
||||
lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1]
|
||||
|
||||
if defined?(I18n.enforce_available_locales)
|
||||
I18n.enforce_available_locales = true
|
||||
end
|
||||
|
||||
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
|
||||
I18n.load_path = Dir["#{File.expand_path('../../i18n', __FILE__)}/*.yml"]
|
||||
I18n.default_locale = :en
|
||||
I18n.locale = lang.to_sym
|
||||
end
|
||||
|
||||
def test_00_config
|
||||
data = { key: 'test@example.com',
|
||||
lang: 'en',
|
||||
wallet_dir: '/tmp/test',
|
||||
gpg_exe: '',
|
||||
}
|
||||
|
||||
@config = MPW::Config.new
|
||||
@config.setup(data[:key], data[:lang], data[:wallet_dir], data[:gpg_exe])
|
||||
@config.load_config
|
||||
|
||||
data.each do |k,v|
|
||||
assert_equal(v, @config.send(k))
|
||||
end
|
||||
|
||||
@config.setup_gpg_key('password', 'test@example.com', 2048)
|
||||
assert(@config.check_gpg_key?)
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue