1 #! /usr/bin/env ruby -S rspec
2 module PuppetSpec::Fixtures
4 File.join(PuppetSpec::FIXTURE_DIR, *rest)
8 while line = callers.shift do
9 next unless found = line.match(%r{/spec/(.*)_spec\.rb:})
10 return fixtures(found[1])
12 fail "sorry, I couldn't work out your path from the caller stack!"
15 file = File.join(my_fixture_dir, name)
16 unless File.readable? file then
17 fail Puppet::DevError, "fixture '#{name}' for #{my_fixture_dir} is not readable"
21 def my_fixtures(glob = '*', flags = 0)
22 files = Dir.glob(File.join(my_fixture_dir, glob), flags)
23 unless files.length > 0 then
24 fail Puppet::DevError, "fixture '#{glob}' for #{my_fixture_dir} had no files!"
26 block_given? and files.each do |file| yield file end