Sha256: 1a1623eb8128c8dd46c77ae219d847c0e4bb1f7d8836495012c04912914c53d4
Contents?: true
Size: 1.56 KB
Versions: 1
Compression:
Stored size: 1.56 KB
Contents
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) $LOAD_PATH.unshift(File.dirname(__FILE__)) require 'rspec' require 'acts-as-messageable' Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f} ActiveRecord::Migration.verbose = false RSpec.configure do |config| config.before(:all) do ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") create_database @alice = User.create :email => "alice@example.com" @bob = User.create :email => "bob@example.com" @admin = Admin.create :email => "admin@example.com" end config.after(:all) do drop_database end config.after(:each) do User.messages_class_name.destroy_all end end def create_database ActiveRecord::Schema.define(:version => 1) do create_table :messages do |t| t.string :topic t.text :body t.references :received_messageable, :polymorphic => true t.references :sent_messageable, :polymorphic => true t.boolean :opened, :default => false t.boolean :recipient_delete, :default => false t.boolean :sender_delete, :default => false t.boolean :recipient_permanent_delete, :default => false t.boolean :sender_permanent_delete, :default => false t.string :ancestry t.timestamps end create_table :users do |t| t.string :email end create_table :admins do |t| t.string :email end end end def drop_database ActiveRecord::Base.connection.tables.each do |table| ActiveRecord::Base.connection.drop_table(table) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
acts-as-messageable-0.4.3 | spec/spec_helper.rb |