Sha256: 2a59be209a84b9397b5d4be645523892e821dbe0d77a299e6bd9a770ac6a32e3

Contents?: true

Size: 1.43 KB

Versions: 5

Compression:

Stored size: 1.43 KB

Contents

require 'fileutils'

# Simulate generating the fixtures.

FileUtils.mkdir_p File.expand_path('../../../tmp/files', __FILE__)

template_path = File.expand_path(
    '../../../lib/file_blobs_rails/generators/templates/file_blobs.yml.erb',
    __FILE__)
output = Erubis::Eruby.new(File.read(template_path)).result(
    file_name: 'file_blob')
File.write File.expand_path('../../../tmp/file_blobs.yml', __FILE__), output

template_path = File.expand_path(
    '../../../lib/file_blobs_rails/generators/templates/blob_owners.yml.erb',
    __FILE__)
output = Erubis::Eruby.new(File.read(template_path)).result(
    file_name: 'blob_owner', options: { allow_nil: false, attr_name: 'file',
    blob_model: 'FileBlob' })
File.write File.expand_path('../../../tmp/blob_owners.yml', __FILE__), output

FileUtils.cp File.expand_path(
    '../../../lib/file_blobs_rails/generators/templates/files/invoice.pdf',
    __FILE__), File.expand_path('../../../tmp/files', __FILE__)
FileUtils.cp File.expand_path(
    '../../../lib/file_blobs_rails/generators/templates/files/ruby.png',
    __FILE__), File.expand_path('../../../tmp/files', __FILE__)


# This needs to happen after the fixture files are created.

class ActiveSupport::TestCase
  include ActiveRecord::TestFixtures

  self.fixture_path = File.expand_path('../../../tmp', __FILE__)

  self.use_transactional_tests = true
  self.use_instantiated_fixtures = false
  self.pre_loaded_fixtures = false
  fixtures :all
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
file_blobs_rails-0.2.3 test/helpers/fixtures.rb
file_blobs_rails-0.2.2 test/helpers/fixtures.rb
file_blobs_rails-0.2.1 test/helpers/fixtures.rb
file_blobs_rails-0.2.0 test/helpers/fixtures.rb
file_blobs_rails-0.1.0 test/helpers/fixtures.rb