Sha256: ca0fb34b9033d7c3d600440566cfcbc8e50b67960d7fdcba34f332abe3295d48

Contents?: true

Size: 914 Bytes

Versions: 2

Compression:

Stored size: 914 Bytes

Contents

require "rails"
require "active_record"
require "two_faced"

ActiveRecord::Migration.verbose = false
ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")

def setup_db
  ActiveRecord::Schema.define(:version => 0) do

    create_table :overrides do |t|
      t.string :context_name
      t.string :overrideable_type
      t.integer :overrideable_id
      t.string :field_name
      t.text :field_value

      t.timestamps
    end

    create_table :model_to_overrides do |t|
      t.string :name
      t.string :description

      t.timestamps
    end
  end
end


setup_db

def cleanup_db
  ActiveRecord::Base.connection.tables.each do |table|
    ActiveRecord::Base.connection.execute("delete from #{table}")
  end
end

class ModelToOverride < ActiveRecord::Base
  attr_accessible :name, :description
  acts_as_overrideable
end


load(File.expand_path( 'app/models/override.rb'))

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
two_faced-0.0.2 spec/spec_helper.rb
two_faced-0.0.2.alpha spec/spec_helper.rb