mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Allow non .aprc
File.readable?
calls
`stub_dotfile!` was blocking all calls to `File.readable?` instead of just calls to load the `.aprc` file. This meant that trying to use other libraries, such as pry, which relied on `File.readable?` would fail in instances where `stub_dotfile!` had been called. This change fixes that, while keeping the original intended behaviour.
This commit is contained in:
parent
056e5c7263
commit
5b472ccbe6
2 changed files with 3 additions and 2 deletions
|
@ -173,7 +173,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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue