Sha256: b0ff435af6b3980440ac32ea7c24bdc0c98f51e787ae7af32c608276554ee79e
Contents?: true
Size: 744 Bytes
Versions: 3
Compression:
Stored size: 744 Bytes
Contents
require 'tmpdir' require 'pathname' require 'fileutils' # stolen with love from the Listen gem include FileUtils # Prepares temporary fixture-directories and # cleans them afterwards. # # @param [Fixnum] number_of_directories the number of fixture-directories to make # # @yield [path1, path2, ...] the empty fixture-directories # @yieldparam [String] path the path to a fixture directory # def fixture_path Pathname.new(File.expand_path(File.join(pwd, "spec/fixtures/#{Time.now.to_f.to_s.sub('.', '') + rand(9999).to_s}"))) end def fixtures(fixt_path=nil) path = fixt_path || fixture_path current_pwd = pwd # Create the path mkdir_p path cd path yield(path) ensure cd current_pwd rm_rf(path) if File.exists?(path) end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
woodchuck-json-event-0.0.2 | spec/support/fixtures_helper.rb |
woodchuck-json-event-0.0.1 | spec/support/fixtures_helper.rb |
woodchuck-0.0.1 | spec/support/fixtures_helper.rb |