Sha256: f9daab8dccf64ebddc1ee6e2787a783e8ebed9d1c86b284ecb9935270c165e7a
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
$LOAD_PATH << File.join(File.dirname(__FILE__), '..', 'lib') require 'acts_as_votable' ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:") ActiveRecord::Schema.define(:version => 1) do create_table :votes do |t| t.references :votable, :polymorphic => true t.references :voter, :polymorphic => true t.boolean :vote_flag t.timestamps end add_index :votes, [:votable_id, :votable_type] add_index :votes, [:voter_id, :voter_type] create_table :voters do |t| t.string :name end create_table :not_voters do |t| t.string :name end create_table :votables do |t| t.string :name end create_table :not_votables do |t| t.string :name end create_table :votable_caches do |t| t.string :name t.integer :cached_votes_total t.integer :cached_votes_up t.integer :cached_votes_down end end class Voter < ActiveRecord::Base acts_as_voter end class NotVoter < ActiveRecord::Base end class Votable < ActiveRecord::Base acts_as_votable validates_presence_of :name end class NotVotable < ActiveRecord::Base end class VotableCache < ActiveRecord::Base acts_as_votable validates_presence_of :name end class ABoringClass def self.hw 'hello world' end end def clean_database models = [ActsAsVotable::Vote, Voter, NotVoter, Votable, NotVotable, VotableCache] models.each do |model| ActiveRecord::Base.connection.execute "DELETE FROM #{model.table_name}" end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
acts_as_votable-0.1.0 | spec/spec_helper.rb |
acts_as_votable-0.0.5 | spec/spec_helper.rb |
acts_as_votable-0.0.4 | spec/spec_helper.rb |