1
0
Fork 0
mirror of https://github.com/awesome-print/awesome_print synced 2023-03-27 23:22:34 -04:00

Merge pull request #251 from gerrywastaken/allow-other-calls-to-readable-method

Allow non `.aprc` `File.readable?` calls
This commit is contained in:
Gerry 2016-07-01 16:36:41 +10:00 committed by GitHub
commit 6184243e96
2 changed files with 3 additions and 2 deletions

View file

@ -175,7 +175,7 @@ module AwesomePrint
# Load ~/.aprc file with custom defaults that override default options.
#------------------------------------------------------------------------------
def merge_custom_defaults!
dotfile = File.join(ENV["HOME"], ".aprc")
dotfile = File.join(ENV['HOME'], '.aprc')
load dotfile if File.readable?(dotfile)
merge_options!(AwesomePrint.defaults) if AwesomePrint.defaults.is_a?(Hash)
rescue => e

View file

@ -71,7 +71,8 @@ def normalize_object_id_strings(str, options)
end
def stub_dotfile!
dotfile = File.join(ENV["HOME"], ".aprc")
dotfile = File.join(ENV['HOME'], '.aprc')
allow(File).to receive(:readable?).and_call_original
expect(File).to receive(:readable?).at_least(:once).with(dotfile).and_return(false)
end