Sha256: e3534713b66ad7ba12c8925b0b45573d6be7c9c646cc3310339b21287a617577

Contents?: true

Size: 873 Bytes

Versions: 1

Compression:

Stored size: 873 Bytes

Contents

dbconfig = {
  :adapter => 'sqlite3',
  :database => ':memory:'
}

ActiveRecord::Base.establish_connection(dbconfig)
ActiveRecord::Migration.verbose = false

class TestUserMigration < ActiveRecord::Migration
  def self.up
    create_table :users, :force => true do |t|
      t.column :name, :string
      t.column :avatar, :string
    end
  end

  def self.down
    drop_table :users
  end
end

$lastUploadedAtachment = nil
$lastDeletedAtachment = nil

class MockUploader < Progstr::Filer::Uploader
  def upload_attachment(attachment)
    $lastUploadedAtachment = attachment
  end
  def delete_attachment(attachment)
    $lastDeletedAtachment = attachment
  end
end


class User < ActiveRecord::Base
  has_file :avatar, MockUploader
end


class UserTest < Test::Unit::TestCase
  def setup
    TestUserMigration.up
  end

  def teardown
    TestUserMigration.down
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
progstr-filer-0.8.0 test/user_data.rb