From 35d181bfac7ec8d6c4f4e4be25e0edc4eddbb01b Mon Sep 17 00:00:00 2001 From: Kyrylo Silin Date: Sun, 9 Jun 2019 18:25:59 +0300 Subject: spec/config: fix flaky test This spec was failing for me locally (but worked well on Circle). The reason is that `XDG_CONFIG_HOME` is set for me and takes precedence. Therefore, the fix would be to unset it for the test. --- spec/config_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spec/config_spec.rb b/spec/config_spec.rb index 99cce54a..db91f7cb 100644 --- a/spec/config_spec.rb +++ b/spec/config_spec.rb @@ -56,14 +56,18 @@ RSpec.describe Pry::Config do end end - context "when ~/.pryrc exists" do + context "when ~/.pryrc exists and $XDG_CONFIG_HOME is undefined" do before do allow(File).to receive(:exist?) expect(File).to receive(:exist?) .with(File.expand_path('~/.pryrc')).and_return(true) + + allow(Pry::Env).to receive(:[]) + allow(Pry::Env).to receive(:[]) + .with('XDG_CONFIG_HOME').and_return(nil) end - it "defaults ~/.pryrc" do + it "defaults to ~/.pryrc" do expect(subject.rc_file).to eq('~/.pryrc') end end -- cgit v1.2.1