Sha256: a83f9208a4117f9ede889c200ff912d32750d74d8a66b7b71ea879f183db345b

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

require 'dm-core'
require 'dm-validations'
require 'dm-aggregates'

DataMapper.setup(:default, 'sqlite3::memory:')

# Fake Category Model
class Category
  include DataMapper::Resource
  property :id,   Serial
  property :name, String
  belongs_to :account
end

# Fake Account Model
class Account
  include DataMapper::Resource
  property :id,   Serial
  property :name, String
  has n, :categories
  def self.admin;  first(:role => "Admin");  end
  def self.editor; first(:role => "Editor"); end
end

Padrino::Admin::Orm.register!
DataMapper.auto_migrate!

# We build some fake accounts
admin  = Account.create(:name => "DAddYE", :role => "Admin",  :email => "d.dagostino@lipsiasoft.com", 
                        :password => "some", :password_confirmation => "some")
editor = Account.create(:name => "Dexter", :role => "Editor", :email => "editor@lipsiasoft.com",
                        :password => "some", :password_confirmation => "some")

%w(News Press HowTo).each do |c| 
  admin.categories.create(:name => c)
  editor.categories.create(:name => c)
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
padrino-admin-0.8.5 test/fixtures/data_mapper.rb
padrino-admin-0.8.4 test/fixtures/data_mapper.rb
padrino-admin-0.8.3 test/fixtures/data_mapper.rb
padrino-admin-0.8.2 test/fixtures/data_mapper.rb
padrino-admin-0.8.1 test/fixtures/data_mapper.rb
padrino-admin-0.8.0 test/fixtures/data_mapper.rb
padrino-admin-0.7.9 test/fixtures/data_mapper.rb
padrino-admin-0.7.8 test/fixtures/data_mapper.rb
padrino-admin-0.7.7 test/fixtures/data_mapper.rb
padrino-admin-0.7.6 test/fixtures/data_mapper.rb
padrino-admin-0.7.5 test/fixtures/data_mapper.rb
padrino-admin-0.7.4 test/fixtures/data_mapper.rb
padrino-admin-0.7.3 test/fixtures/data_mapper.rb
padrino-admin-0.7.2 test/fixtures/data_mapper.rb
padrino-admin-0.7.1 test/fixtures/data_mapper.rb
padrino-admin-0.7.0 test/fixtures/data_mapper.rb
padrino-admin-0.6.7 test/fixtures/data_mapper.rb