Sha256: 7e125a979766ffc674ddac387c4b6bc233b1bf025f9db2e177043f442d047bfd
Contents?: true
Size: 1.5 KB
Versions: 3
Compression:
Stored size: 1.5 KB
Contents
require 'pathname' require 'tmpdir' require_relative '../spec_helper' require_relative '../../lib/signore/settings' require_relative '../../lib/signore/tags' module Signore describe Settings do describe '#action' do it 'is defined by the first argument' do Settings.new(['prego']).action.must_equal 'prego' end end describe '#db_path' do it 'honours XDG_DATA_HOME if it’s set' do begin old_xdg = ENV.delete('XDG_DATA_HOME') tempdir = Dir.mktmpdir ENV['XDG_DATA_HOME'] = tempdir path = "#{tempdir}/signore/signatures.yml" Settings.new.db_path.must_equal Pathname.new(path) ensure FileUtils.rmtree tempdir old_xdg ? ENV['XDG_DATA_HOME'] = old_xdg : ENV.delete('XDG_DATA_HOME') end end it 'defaults XDG_DATA_HOME to ~/.local/share if it’s not set' do begin old_xdg = ENV.delete('XDG_DATA_HOME') path = File.expand_path('~/.local/share/signore/signatures.yml') Settings.new.db_path.must_equal Pathname.new(path) ensure ENV['XDG_DATA_HOME'] = old_xdg if old_xdg end end end describe '#tags' do it 'returns the forbidden and required tags' do tags = Tags.new(forbidden: %w(tech), required: %w(en)) Settings.new(%w(prego ~tech en)).tags.must_equal tags end it 'doesn’t blow up on empty args' do Settings.new([]).tags.must_equal Tags.new end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
signore-0.3.1 | spec/signore/settings_spec.rb |
signore-0.3.0 | spec/signore/settings_spec.rb |
signore-0.2.4 | spec/signore/settings_spec.rb |