summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlbert Song <albb@teamt5.org>2017-02-08 12:11:30 +0800
committerAlbert Song <albb@teamt5.org>2017-02-08 12:11:30 +0800
commitf6540277b39e85a759bb99e58c28449272cd4fed (patch)
treeb4f913fd7a311185cdf08ef8a575599d6df017cf /spec
parentba5854a8df89a5e930587622a74a5b188e9a5e06 (diff)
downloadhashie-f6540277b39e85a759bb99e58c28449272cd4fed.tar.gz
Fix passing Pathname object to Hashie::Mesh.load()
With a test that would fail without this patch.
Diffstat (limited to 'spec')
-rw-r--r--spec/hashie/mash_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/hashie/mash_spec.rb b/spec/hashie/mash_spec.rb
index 08eac9b..b66b9ba 100644
--- a/spec/hashie/mash_spec.rb
+++ b/spec/hashie/mash_spec.rb
@@ -632,6 +632,20 @@ describe Hashie::Mash do
end
end
+ context 'if the file is passed as Pathname' do
+ require 'pathname'
+ let(:path) { Pathname.new('database.yml') }
+
+ before do
+ expect(File).to receive(:file?).with(path).and_return(true)
+ expect(parser).to receive(:perform).with(path).and_return(config)
+ end
+
+ it 'return a Mash from a file' do
+ expect(subject.production.foo).to eq config['production']['foo']
+ end
+ end
+
describe 'results are cached' do
let(:parser) { double(:parser) }