Sha256: c9766a93eaafa78ef68774a9249f78ac15a549c843aa3340ac479fd220793a77

Contents?: true

Size: 609 Bytes

Versions: 3

Compression:

Stored size: 609 Bytes

Contents

require 'fileutils'

module FileHelper
  def self.included(base)
    base.class_eval do
      let(:cache_path) do
        path = ::File.join(::File.dirname(__FILE__), '/../tmp/', 'cache')
        File.expand_path path
      end

      before do
        FileUtils.rm_rf(::File.dirname(cache_path))
        FileUtils.mkdir_p(cache_path)
      end

      after { FileUtils.rm_rf(::File.dirname(cache_path)) }
    end

    def assert_cache_folder_is_empty
      assert(
        Dir.entries(cache_path).reject { |f| %w{. ..}.include? f }.size == 0,
        'cache folder should be empty'
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-page_caching-0.0.3 test/support/file_helper.rb
rack-page_caching-0.0.2 test/support/file_helper.rb
rack-page_caching-0.0.1 test/support/file_helper.rb