test/signore/settings_test.rb in signore-0.6.0 vs test/signore/settings_test.rb in signore-0.7.0
- old
+ new
@@ -1,7 +1,6 @@
-# frozen_string_literal: true
-
+require 'fileutils'
require 'pathname'
require 'tmpdir'
require_relative '../test_helper'
require_relative '../../lib/signore/settings'
require_relative '../../lib/signore/tags'
@@ -12,37 +11,13 @@
it 'is defined by the first argument' do
_(Settings.new(['prego']).action).must_equal 'prego'
end
end
- describe '#repo_path' do
- it 'honours XDG_DATA_HOME if it’s set' do
- begin
- old_xdg = ENV.delete('XDG_DATA_HOME')
- ENV['XDG_DATA_HOME'] = Dir.mktmpdir
- path = "#{ENV['XDG_DATA_HOME']}/signore/signatures.yml"
- _(Settings.new.repo_path).must_equal Pathname.new(path)
- ensure
- FileUtils.rmtree ENV['XDG_DATA_HOME']
- 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.repo_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
+ 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