summaryrefslogtreecommitdiff
path: root/spec/config_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/config_spec.rb')
-rw-r--r--spec/config_spec.rb29
1 files changed, 21 insertions, 8 deletions
diff --git a/spec/config_spec.rb b/spec/config_spec.rb
index d42d4d1e..d2cda05e 100644
--- a/spec/config_spec.rb
+++ b/spec/config_spec.rb
@@ -67,18 +67,31 @@ RSpec.describe Pry::Config do
end
context "when $XDG_CONFIG_HOME is defined" do
- before do
- allow(File).to receive(:exist?)
- expect(File).to receive(:exist?)
- .with(File.expand_path('~/.pryrc')).and_return(false)
+ before { ENV['XDG_CONFIG_HOME'] = '/xdg_home' }
+ after { ENV.delete('XDG_CONFIG_HOME') }
+
+ context "when ~/.pryrc exists" do
+ before do
+ allow(File).to receive(:exist?)
+ expect(File).to receive(:exist?)
+ .with(File.expand_path('~/.pryrc')).and_return(true)
+ end
- ENV['XDG_CONFIG_HOME'] = '/xdg_home'
+ it "defaults $XDG_CONFIG_HOME/pry/pryrc" do
+ expect(subject.rc_file).to eq('/xdg_home/pry/pryrc')
+ end
end
- after { ENV.delete('XDG_CONFIG_HOME') }
+ context "when ~/.pryrc doesn't exist" do
+ before do
+ allow(File).to receive(:exist?)
+ expect(File).to receive(:exist?)
+ .with(File.expand_path('~/.pryrc')).and_return(false)
+ end
- it "defaults $XDG_CONFIG_HOME/pry/pryrc" do
- expect(subject.rc_file).to eq('/xdg_home/pry/pryrc')
+ it "defaults $XDG_CONFIG_HOME/pry/pryrc" do
+ expect(subject.rc_file).to eq('/xdg_home/pry/pryrc')
+ end
end
end
end