Sha256: bfe9b2842fcf12268c11d5fa3926abc2b4caff68bbf094b5176cd1e5f63778d8

Contents?: true

Size: 795 Bytes

Versions: 14

Compression:

Stored size: 795 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 |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

  def get_instance_variables(obj)
    obj.instance_variables.inject({}) do |memo, name|
      value = obj.instance_variable_get(name)
      if value.instance_variables.empty?
        memo[name] = value
      else
        memo[name] = get_instance_variables(value)
      end
      memo
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
review-2.0.0 test/book_test_helper.rb
review-1.7.2 test/book_test_helper.rb
review-1.7.1 test/book_test_helper.rb
review-peg-0.2.2 test/book_test_helper.rb
review-peg-0.2.1 test/book_test_helper.rb
review-peg-0.2.0 test/book_test_helper.rb
review-peg-0.1.3 test/book_test_helper.rb
review-peg-0.1.2 test/book_test_helper.rb
review-peg-0.1.1 test/book_test_helper.rb
review-peg-0.1.0 test/book_test_helper.rb
review-1.7.0 test/book_test_helper.rb
review-1.6.0 test/book_test_helper.rb
review-2.0.0.beta1 test/book_test_helper.rb
review-1.5.0 test/book_test_helper.rb