Sha256: 8482f6438d4b9eca0c5bba0c61f532e483527d6bbc28fe531bedf27c6dead4fe

Contents?: true

Size: 1.82 KB

Versions: 2

Compression:

Stored size: 1.82 KB

Contents

$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
$:.unshift File.expand_path(File.dirname(__FILE__))

require 'rubygems'
require 'active_support'
require 'active_record'
require 'activerecord-postgres-hstore/activerecord'
require 'activerecord-postgres-hstore/coder'
require 'activerecord-postgres-hstore/hash'
require 'activerecord-postgres-hstore/string'
require 'multilang-hstore'
require 'logger'

ActiveRecord::Base.logger = Logger.new(nil)
ActiveRecord::Base.establish_connection(:adapter => "postgresql", :database => "multilang-hstore-test", :host=>'127.0.0.1', :user=>'postgres')

I18n.available_locales = [:lv, :ru]
I18n.locale = I18n.default_locale = :lv

def setup_db
  ActiveRecord::Migration.verbose = false
  load "schema.rb"
end

def teardown_db
  ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end

#testable models
class AbstractPost < ActiveRecord::Base
  serialize :title, ActiveRecord::Coders::Hstore
  serialize :body, ActiveRecord::Coders::Hstore
end

class MinimalPost < ActiveRecord::Base
  self.table_name = 'abstract_posts'
  multilang :title, :required => false,  :accessible => true
  multilang :body,  :required => false, :accessible => true
  attr_accessible :void
end

class RegularPost < ActiveRecord::Base
  self.table_name = 'abstract_posts'
  multilang :title, :required => true, :length => 25,   :accessible => true
  multilang :body,  :required => true, :length => 1000, :accessible => true
  attr_accessible :void
end

class ProtectedPost < ActiveRecord::Base
  self.table_name = 'abstract_posts'
  multilang :title, :accessible => false
  multilang :body,  :accessible => false
  attr_accessible :void
end

class PartialPost < ActiveRecord::Base
  self.table_name = 'abstract_posts'
  multilang :title
  multilang :body
  attr_accessible :void
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
multilang-hstore-0.2 spec/spec_helper.rb
multilang-hstore-0.1 spec/spec_helper.rb