Sha256: b9da1a997a679ad257eb9b6fff062c82945797e31ae2b30ebb3ce033b20cb7f8
Contents?: true
Size: 867 Bytes
Versions: 1
Compression:
Stored size: 867 Bytes
Contents
require 'test_helper' require 'review/book' require 'stringio' require 'tempfile' require 'tmpdir' include ReVIEW module BookTestHelper def mktmpbookdir(files = {}) created_files = {} Dir.mktmpdir do |tmpdir| Dir.chdir(tmpdir) do dir = '.' files.each_pair do |basename, content| path = File.join(dir, basename) File.open(path, 'w') { |o| o.print content } created_files[basename] = path end book = Book::Base.load(dir) yield(dir, book, created_files) end end end def get_instance_variables(obj) obj.instance_variables.each_with_object({}) do |name, memo| value = obj.instance_variable_get(name) if value.instance_variables.empty? memo[name] = value else memo[name] = get_instance_variables(value) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
review-2.4.0 | test/book_test_helper.rb |