Hi
Look into
rspec-puppet-utils, you can use the MockFunction class to completely mock hiera (there's an example in the readme). This way your tests never even execute the real hiera function, so you don't need to worry about yaml files, eyaml files, hierarchies, eyaml installation, eyaml keys, etc
This is more like unit testing in a Java/C#/ruby project, where you're isolating what you want to test away from it's dependencies. Mocking hiera allows your tests to be very flexible with minimal setup, and you're also not testing hiera/hiera-ayaml functionality in your tests for foo
Full disclosure: I wrote rspec-puppet-utils so naturally I think it's a useful tool and a good fit in this case, but there are other ways of doing it :)
Does that make sense? I hope it helps