diff --git a/.gitignore b/.gitignore index 9e91ff7d..ee989ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.swp doc pkg/*.gem -spec/tmp # skip Gemfile.lock since this is a gem Gemfile.lock diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7bcbcb38..4a06708c 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -6,46 +6,18 @@ Vips.set_debug ENV["DEBUG"] # Vips.leak_set true -module Spec - module Path - def set_root(path) - @root = Pathname.new(path).expand_path - end - - def sample(*path) - root.join "samples", *path - end - - def tmp(*path) - root.join "tmp", "working", *path - end - - extend self - - private - - def root - @root ||= set_root(File.expand_path("..", __FILE__)) - end - end -end - def simg(name) - Spec::Path.sample(name).to_s + File.join(File.expand_path("..", __FILE__), "samples", name) end def timg(name) - Spec::Path.tmp(name).to_s + File.join(@temp_dir, name) end RSpec.configure do |config| - config.include Spec::Path - config.around do |example| - Dir.mktmpdir do |dir| - set_root(dir) - FileUtils.mkdir_p(Spec::Path.sample) - FileUtils.mkdir_p(Spec::Path.tmp) + Dir.mktmpdir("ruby-vips-spec-") do |dir| + @temp_dir = dir example.run end end