Experiment with Hamster
This commit is contained in:
parent
55c5a46440
commit
22ce56492f
9 changed files with 57 additions and 120 deletions
|
@ -54,30 +54,30 @@ describe Middleman::Util do
|
|||
end
|
||||
|
||||
describe "::recursively_enhance" do
|
||||
it "returns HashWithIndifferentAccess if given one" do
|
||||
input = Middleman::Util::HashWithIndifferentAccess.new({test: "subject"})
|
||||
it "returns IndifferentHash if given one" do
|
||||
input = Middleman::Util::IndifferentHash.new({test: "subject"})
|
||||
subject = Middleman::Util.recursively_enhance input
|
||||
|
||||
expect( subject ).to be_a Middleman::Util::HashWithIndifferentAccess
|
||||
expect( subject ).to be_a Middleman::Util::IndifferentHash
|
||||
expect( subject.test ).to eq "subject"
|
||||
end
|
||||
|
||||
it "returns HashWithIndifferentAccess if given a hash" do
|
||||
it "returns IndifferentHash if given a hash" do
|
||||
input = {test: "subject"}
|
||||
subject = Middleman::Util.recursively_enhance input
|
||||
|
||||
expect( subject ).to be_a Middleman::Util::HashWithIndifferentAccess
|
||||
expect( subject ).to be_a Middleman::Util::IndifferentHash
|
||||
expect( subject.test ).to eq "subject"
|
||||
end
|
||||
|
||||
it "returns Array with strings, or HashWithIndifferentAccess, true, false" do
|
||||
indifferent_hash = Middleman::Util::HashWithIndifferentAccess.new({test: "subject"})
|
||||
it "returns Array with strings, or IndifferentHash, true, false" do
|
||||
indifferent_hash = Middleman::Util::IndifferentHash.new({test: "subject"})
|
||||
regular_hash = {regular: "hash"}
|
||||
input = [ indifferent_hash, regular_hash, true, false ]
|
||||
subject = Middleman::Util.recursively_enhance input
|
||||
|
||||
expect( subject[0] ).to be_a Middleman::Util::HashWithIndifferentAccess
|
||||
expect( subject[1] ).to be_a Middleman::Util::HashWithIndifferentAccess
|
||||
expect( subject[0] ).to be_a Middleman::Util::IndifferentHash
|
||||
expect( subject[1] ).to be_a Middleman::Util::IndifferentHash
|
||||
expect( subject[1].regular ).to eq "hash"
|
||||
expect( subject[2] ).to eq true
|
||||
expect( subject[3] ).to eq false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue