diff options
Diffstat (limited to 'activerecord/test/fixtures')
47 files changed, 0 insertions, 788 deletions
diff --git a/activerecord/test/fixtures/author.rb b/activerecord/test/fixtures/author.rb deleted file mode 100644 index 538ed7ac7f..0000000000 --- a/activerecord/test/fixtures/author.rb +++ /dev/null @@ -1,109 +0,0 @@ -class Author < ActiveRecord::Base - has_many :posts - has_many :posts_with_comments, :include => :comments, :class_name => "Post" - has_many :posts_with_categories, :include => :categories, :class_name => "Post" - has_many :posts_with_comments_and_categories, :include => [ :comments, :categories ], :order => "posts.id", :class_name => "Post" - has_many :posts_with_extension, :class_name => "Post" do #, :extend => ProxyTestExtension - def testing_proxy_owner - proxy_owner - end - def testing_proxy_reflection - proxy_reflection - end - def testing_proxy_target - proxy_target - end - end - has_many :comments, :through => :posts - has_many :comments_desc, :through => :posts, :source => :comments, :order => 'comments.id DESC' - has_many :limited_comments, :through => :posts, :source => :comments, :limit => 1 - has_many :funky_comments, :through => :posts, :source => :comments - has_many :ordered_uniq_comments, :through => :posts, :source => :comments, :uniq => true, :order => 'comments.id' - has_many :ordered_uniq_comments_desc, :through => :posts, :source => :comments, :uniq => true, :order => 'comments.id DESC' - - has_many :special_posts - has_many :special_post_comments, :through => :special_posts, :source => :comments - - has_many :special_nonexistant_posts, :class_name => "SpecialPost", :conditions => "posts.body = 'nonexistant'" - has_many :special_nonexistant_post_comments, :through => :special_nonexistant_posts, :source => :comments, :conditions => "comments.post_id = 0" - has_many :nonexistant_comments, :through => :posts - - has_many :hello_posts, :class_name => "Post", :conditions => "posts.body = 'hello'" - has_many :hello_post_comments, :through => :hello_posts, :source => :comments - has_many :posts_with_no_comments, :class_name => 'Post', :conditions => 'comments.id is null', :include => :comments - - has_many :other_posts, :class_name => "Post" - has_many :posts_with_callbacks, :class_name => "Post", :before_add => :log_before_adding, - :after_add => :log_after_adding, - :before_remove => :log_before_removing, - :after_remove => :log_after_removing - has_many :posts_with_proc_callbacks, :class_name => "Post", - :before_add => Proc.new {|o, r| o.post_log << "before_adding#{r.id || '<new>'}"}, - :after_add => Proc.new {|o, r| o.post_log << "after_adding#{r.id || '<new>'}"}, - :before_remove => Proc.new {|o, r| o.post_log << "before_removing#{r.id}"}, - :after_remove => Proc.new {|o, r| o.post_log << "after_removing#{r.id}"} - has_many :posts_with_multiple_callbacks, :class_name => "Post", - :before_add => [:log_before_adding, Proc.new {|o, r| o.post_log << "before_adding_proc#{r.id || '<new>'}"}], - :after_add => [:log_after_adding, Proc.new {|o, r| o.post_log << "after_adding_proc#{r.id || '<new>'}"}] - has_many :unchangable_posts, :class_name => "Post", :before_add => :raise_exception, :after_add => :log_after_adding - - has_many :categorizations - has_many :categories, :through => :categorizations - - has_many :categories_like_general, :through => :categorizations, :source => :category, :class_name => 'Category', :conditions => { :name => 'General' } - - has_many :categorized_posts, :through => :categorizations, :source => :post - has_many :unique_categorized_posts, :through => :categorizations, :source => :post, :uniq => true - - has_many :nothings, :through => :kateggorisatons, :class_name => 'Category' - - has_many :author_favorites - has_many :favorite_authors, :through => :author_favorites, :order => 'name' - - has_many :tagging, :through => :posts # through polymorphic has_one - has_many :taggings, :through => :posts, :source => :taggings # through polymorphic has_many - has_many :tags, :through => :posts # through has_many :through - has_many :post_categories, :through => :posts, :source => :categories - - belongs_to :author_address - - attr_accessor :post_log - - def after_initialize - @post_log = [] - end - - def label - "#{id}-#{name}" - end - - private - def log_before_adding(object) - @post_log << "before_adding#{object.id || '<new>'}" - end - - def log_after_adding(object) - @post_log << "after_adding#{object.id}" - end - - def log_before_removing(object) - @post_log << "before_removing#{object.id}" - end - - def log_after_removing(object) - @post_log << "after_removing#{object.id}" - end - - def raise_exception(object) - raise Exception.new("You can't add a post") - end -end - -class AuthorAddress < ActiveRecord::Base - has_one :author -end - -class AuthorFavorite < ActiveRecord::Base - belongs_to :author - belongs_to :favorite_author, :class_name => "Author" -end diff --git a/activerecord/test/fixtures/auto_id.rb b/activerecord/test/fixtures/auto_id.rb deleted file mode 100644 index d720e2be5e..0000000000 --- a/activerecord/test/fixtures/auto_id.rb +++ /dev/null @@ -1,4 +0,0 @@ -class AutoId < ActiveRecord::Base - def self.table_name () "auto_id_tests" end - def self.primary_key () "auto_id" end -end diff --git a/activerecord/test/fixtures/binary.rb b/activerecord/test/fixtures/binary.rb deleted file mode 100644 index 950c459199..0000000000 --- a/activerecord/test/fixtures/binary.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Binary < ActiveRecord::Base -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/book.rb b/activerecord/test/fixtures/book.rb deleted file mode 100644 index cfd07abddc..0000000000 --- a/activerecord/test/fixtures/book.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Book < ActiveRecord::Base - has_many :citations, :foreign_key => 'book1_id' - has_many :references, :through => :citations, :source => :reference_of, :uniq => true -end diff --git a/activerecord/test/fixtures/categorization.rb b/activerecord/test/fixtures/categorization.rb deleted file mode 100644 index 10594323ff..0000000000 --- a/activerecord/test/fixtures/categorization.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Categorization < ActiveRecord::Base - belongs_to :post - belongs_to :category - belongs_to :author -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/category.rb b/activerecord/test/fixtures/category.rb deleted file mode 100644 index 71685234e3..0000000000 --- a/activerecord/test/fixtures/category.rb +++ /dev/null @@ -1,26 +0,0 @@ -class Category < ActiveRecord::Base - has_and_belongs_to_many :posts - has_and_belongs_to_many :special_posts, :class_name => "Post" - has_and_belongs_to_many :other_posts, :class_name => "Post" - - has_and_belongs_to_many(:select_testing_posts, - :class_name => 'Post', - :foreign_key => 'category_id', - :association_foreign_key => 'post_id', - :select => 'posts.*, 1 as correctness_marker') - - def self.what_are_you - 'a category...' - end - - has_many :categorizations - has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id' -end - -class SpecialCategory < Category - - def self.what_are_you - 'a special category...' - end - -end diff --git a/activerecord/test/fixtures/citation.rb b/activerecord/test/fixtures/citation.rb deleted file mode 100644 index 545aa8110d..0000000000 --- a/activerecord/test/fixtures/citation.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Citation < ActiveRecord::Base - belongs_to :reference_of, :class_name => "Book", :foreign_key => :book2_id - - belongs_to :book1, :class_name => "Book", :foreign_key => :book1_id - belongs_to :book2, :class_name => "Book", :foreign_key => :book2_id -end diff --git a/activerecord/test/fixtures/column_name.rb b/activerecord/test/fixtures/column_name.rb deleted file mode 100644 index ec07205a3a..0000000000 --- a/activerecord/test/fixtures/column_name.rb +++ /dev/null @@ -1,3 +0,0 @@ -class ColumnName < ActiveRecord::Base - def self.table_name () "colnametests" end -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/comment.rb b/activerecord/test/fixtures/comment.rb deleted file mode 100644 index 3eab263fa4..0000000000 --- a/activerecord/test/fixtures/comment.rb +++ /dev/null @@ -1,23 +0,0 @@ -class Comment < ActiveRecord::Base - belongs_to :post - - def self.what_are_you - 'a comment...' - end - - def self.search_by_type(q) - self.find(:all, :conditions => ["#{QUOTED_TYPE} = ?", q]) - end -end - -class SpecialComment < Comment - def self.what_are_you - 'a special comment...' - end -end - -class VerySpecialComment < Comment - def self.what_are_you - 'a very special comment...' - end -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/company.rb b/activerecord/test/fixtures/company.rb deleted file mode 100755 index 1048d5a652..0000000000 --- a/activerecord/test/fixtures/company.rb +++ /dev/null @@ -1,114 +0,0 @@ -class AbstractCompany < ActiveRecord::Base - self.abstract_class = true -end - -class Company < AbstractCompany - attr_protected :rating - set_sequence_name :companies_nonstd_seq - - validates_presence_of :name - - has_one :dummy_account, :foreign_key => "firm_id", :class_name => "Account" - - def arbitrary_method - "I am Jack's profound disappointment" - end -end - - -class Firm < Company - has_many :clients, :order => "id", :dependent => :destroy, :counter_sql => - "SELECT COUNT(*) FROM companies WHERE firm_id = 1 " + - "AND (#{QUOTED_TYPE} = 'Client' OR #{QUOTED_TYPE} = 'SpecialClient' OR #{QUOTED_TYPE} = 'VerySpecialClient' )" - has_many :clients_sorted_desc, :class_name => "Client", :order => "id DESC" - has_many :clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id" - has_many :dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :destroy - has_many :exclusively_dependent_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all - has_many :limited_clients, :class_name => "Client", :order => "id", :limit => 1 - has_many :clients_like_ms, :conditions => "name = 'Microsoft'", :class_name => "Client", :order => "id" - has_many :clients_with_interpolated_conditions, :class_name => "Client", :conditions => 'rating > #{rating}' - has_many :clients_like_ms_with_hash_conditions, :conditions => { :name => 'Microsoft' }, :class_name => "Client", :order => "id" - has_many :clients_using_sql, :class_name => "Client", :finder_sql => 'SELECT * FROM companies WHERE client_of = #{id}' - has_many :clients_using_counter_sql, :class_name => "Client", - :finder_sql => 'SELECT * FROM companies WHERE client_of = #{id}', - :counter_sql => 'SELECT COUNT(*) FROM companies WHERE client_of = #{id}' - has_many :clients_using_zero_counter_sql, :class_name => "Client", - :finder_sql => 'SELECT * FROM companies WHERE client_of = #{id}', - :counter_sql => 'SELECT 0 FROM companies WHERE client_of = #{id}' - has_many :no_clients_using_counter_sql, :class_name => "Client", - :finder_sql => 'SELECT * FROM companies WHERE client_of = 1000', - :counter_sql => 'SELECT COUNT(*) FROM companies WHERE client_of = 1000' - has_many :clients_using_finder_sql, :class_name => "Client", :finder_sql => 'SELECT * FROM companies WHERE 1=1' - has_many :plain_clients, :class_name => 'Client' - - has_one :account, :foreign_key => "firm_id", :dependent => :destroy -end - -class DependentFirm < Company - has_one :account, :foreign_key => "firm_id", :dependent => :nullify - has_many :companies, :foreign_key => 'client_of', :order => "id", :dependent => :nullify -end - -class ExclusivelyDependentFirm < Company - has_one :account, :foreign_key => "firm_id", :dependent => :delete - has_many :dependent_sanitized_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => "name = 'BigShot Inc.'" - has_many :dependent_conditional_clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id", :dependent => :delete_all, :conditions => ["name = ?", 'BigShot Inc.'] -end - -class Client < Company - belongs_to :firm, :foreign_key => "client_of" - belongs_to :firm_with_basic_id, :class_name => "Firm", :foreign_key => "firm_id" - belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of" - belongs_to :firm_with_condition, :class_name => "Firm", :foreign_key => "client_of", :conditions => ["1 = ?", 1] - - # Record destruction so we can test whether firm.clients.clear has - # is calling client.destroy, deleting from the database, or setting - # foreign keys to NULL. - def self.destroyed_client_ids - @destroyed_client_ids ||= Hash.new { |h,k| h[k] = [] } - end - - before_destroy do |client| - if client.firm - Client.destroyed_client_ids[client.firm.id] << client.id - end - true - end - - # Used to test that read and question methods are not generated for these attributes - def ruby_type - read_attribute :ruby_type - end - - def rating? - query_attribute :rating - end -end - - -class SpecialClient < Client -end - -class VerySpecialClient < SpecialClient -end - -class Account < ActiveRecord::Base - belongs_to :firm - - def self.destroyed_account_ids - @destroyed_account_ids ||= Hash.new { |h,k| h[k] = [] } - end - - before_destroy do |account| - if account.firm - Account.destroyed_account_ids[account.firm.id] << account.id - end - true - end - - - protected - def validate - errors.add_on_empty "credit_limit" - end -end diff --git a/activerecord/test/fixtures/company_in_module.rb b/activerecord/test/fixtures/company_in_module.rb deleted file mode 100644 index feb3210c02..0000000000 --- a/activerecord/test/fixtures/company_in_module.rb +++ /dev/null @@ -1,59 +0,0 @@ -module MyApplication - module Business - class Company < ActiveRecord::Base - attr_protected :rating - end - - class Firm < Company - has_many :clients, :order => "id", :dependent => :destroy - has_many :clients_sorted_desc, :class_name => "Client", :order => "id DESC" - has_many :clients_of_firm, :foreign_key => "client_of", :class_name => "Client", :order => "id" - has_many :clients_like_ms, :conditions => "name = 'Microsoft'", :class_name => "Client", :order => "id" - has_many :clients_using_sql, :class_name => "Client", :finder_sql => 'SELECT * FROM companies WHERE client_of = #{id}' - - has_one :account, :dependent => :destroy - end - - class Client < Company - belongs_to :firm, :foreign_key => "client_of" - belongs_to :firm_with_other_name, :class_name => "Firm", :foreign_key => "client_of" - end - - class Developer < ActiveRecord::Base - has_and_belongs_to_many :projects - validates_length_of :name, :within => (3..20) - end - - class Project < ActiveRecord::Base - has_and_belongs_to_many :developers - end - - end - - module Billing - class Firm < ActiveRecord::Base - self.table_name = 'companies' - end - - module Nested - class Firm < ActiveRecord::Base - self.table_name = 'companies' - end - end - - class Account < ActiveRecord::Base - with_options(:foreign_key => :firm_id) do |i| - i.belongs_to :firm, :class_name => 'MyApplication::Business::Firm' - i.belongs_to :qualified_billing_firm, :class_name => 'MyApplication::Billing::Firm' - i.belongs_to :unqualified_billing_firm, :class_name => 'Firm' - i.belongs_to :nested_qualified_billing_firm, :class_name => 'MyApplication::Billing::Nested::Firm' - i.belongs_to :nested_unqualified_billing_firm, :class_name => 'Nested::Firm' - end - - protected - def validate - errors.add_on_empty "credit_limit" - end - end - end -end diff --git a/activerecord/test/fixtures/computer.rb b/activerecord/test/fixtures/computer.rb deleted file mode 100644 index f26312f9a6..0000000000 --- a/activerecord/test/fixtures/computer.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Computer < ActiveRecord::Base - belongs_to :developer, :foreign_key=>'developer' -end - diff --git a/activerecord/test/fixtures/contact.rb b/activerecord/test/fixtures/contact.rb deleted file mode 100644 index c574196d94..0000000000 --- a/activerecord/test/fixtures/contact.rb +++ /dev/null @@ -1,16 +0,0 @@ -class Contact < ActiveRecord::Base - # mock out self.columns so no pesky db is needed for these tests - def self.column(name, sql_type = nil, options = {}) - @columns ||= [] - @columns << ActiveRecord::ConnectionAdapters::Column.new(name.to_s, options[:default], sql_type.to_s, options[:null]) - end - - column :name, :string - column :age, :integer - column :avatar, :binary - column :created_at, :datetime - column :awesome, :boolean - column :preferences, :string - - serialize :preferences -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/course.rb b/activerecord/test/fixtures/course.rb deleted file mode 100644 index 8a40fa740d..0000000000 --- a/activerecord/test/fixtures/course.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Course < ActiveRecord::Base - has_many :entrants -end diff --git a/activerecord/test/fixtures/customer.rb b/activerecord/test/fixtures/customer.rb deleted file mode 100644 index 3d8d644f12..0000000000 --- a/activerecord/test/fixtures/customer.rb +++ /dev/null @@ -1,55 +0,0 @@ -class Customer < ActiveRecord::Base - composed_of :address, :mapping => [ %w(address_street street), %w(address_city city), %w(address_country country) ], :allow_nil => true - composed_of(:balance, :class_name => "Money", :mapping => %w(balance amount)) { |balance| balance.to_money } - composed_of :gps_location, :allow_nil => true -end - -class Address - attr_reader :street, :city, :country - - def initialize(street, city, country) - @street, @city, @country = street, city, country - end - - def close_to?(other_address) - city == other_address.city && country == other_address.country - end - - def ==(other) - other.is_a?(self.class) && other.street == street && other.city == city && other.country == country - end -end - -class Money - attr_reader :amount, :currency - - EXCHANGE_RATES = { "USD_TO_DKK" => 6, "DKK_TO_USD" => 0.6 } - - def initialize(amount, currency = "USD") - @amount, @currency = amount, currency - end - - def exchange_to(other_currency) - Money.new((amount * EXCHANGE_RATES["#{currency}_TO_#{other_currency}"]).floor, other_currency) - end -end - -class GpsLocation - attr_reader :gps_location - - def initialize(gps_location) - @gps_location = gps_location - end - - def latitude - gps_location.split("x").first - end - - def longitude - gps_location.split("x").last - end - - def ==(other) - self.latitude == other.latitude && self.longitude == other.longitude - end -end diff --git a/activerecord/test/fixtures/default.rb b/activerecord/test/fixtures/default.rb deleted file mode 100644 index 887e9cc999..0000000000 --- a/activerecord/test/fixtures/default.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Default < ActiveRecord::Base -end diff --git a/activerecord/test/fixtures/developer.rb b/activerecord/test/fixtures/developer.rb deleted file mode 100644 index 20005ed04e..0000000000 --- a/activerecord/test/fixtures/developer.rb +++ /dev/null @@ -1,72 +0,0 @@ -module DeveloperProjectsAssociationExtension - def find_most_recent - find(:first, :order => "id DESC") - end -end - -module DeveloperProjectsAssociationExtension2 - def find_least_recent - find(:first, :order => "id ASC") - end -end - -class Developer < ActiveRecord::Base - has_and_belongs_to_many :projects do - def find_most_recent - find(:first, :order => "id DESC") - end - end - - has_and_belongs_to_many :projects_extended_by_name, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => DeveloperProjectsAssociationExtension - - has_and_belongs_to_many :projects_extended_by_name_twice, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => [DeveloperProjectsAssociationExtension, DeveloperProjectsAssociationExtension2] - - has_and_belongs_to_many :projects_extended_by_name_and_block, - :class_name => "Project", - :join_table => "developers_projects", - :association_foreign_key => "project_id", - :extend => DeveloperProjectsAssociationExtension do - def find_least_recent - find(:first, :order => "id ASC") - end - end - - has_and_belongs_to_many :special_projects, :join_table => 'developers_projects', :association_foreign_key => 'project_id' - - has_many :audit_logs - - validates_inclusion_of :salary, :in => 50000..200000 - validates_length_of :name, :within => 3..20 - - before_create do |developer| - developer.audit_logs.build :message => "Computer created" - end -end - -class AuditLog < ActiveRecord::Base - belongs_to :developer -end - -DeveloperSalary = Struct.new(:amount) -class DeveloperWithAggregate < ActiveRecord::Base - self.table_name = 'developers' - composed_of :salary, :class_name => 'DeveloperSalary', :mapping => [%w(salary amount)] -end - -class DeveloperWithBeforeDestroyRaise < ActiveRecord::Base - self.table_name = 'developers' - has_and_belongs_to_many :projects, :join_table => 'developers_projects', :foreign_key => 'developer_id' - before_destroy :raise_if_projects_empty! - - def raise_if_projects_empty! - raise if projects.empty? - end -end diff --git a/activerecord/test/fixtures/edge.rb b/activerecord/test/fixtures/edge.rb deleted file mode 100644 index 55e0c31fcb..0000000000 --- a/activerecord/test/fixtures/edge.rb +++ /dev/null @@ -1,5 +0,0 @@ -# This class models an edge in a directed graph. -class Edge < ActiveRecord::Base - belongs_to :source, :class_name => 'Vertex', :foreign_key => 'source_id' - belongs_to :sink, :class_name => 'Vertex', :foreign_key => 'sink_id' -end diff --git a/activerecord/test/fixtures/entrant.rb b/activerecord/test/fixtures/entrant.rb deleted file mode 100644 index 4682ce48c8..0000000000 --- a/activerecord/test/fixtures/entrant.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Entrant < ActiveRecord::Base - belongs_to :course -end diff --git a/activerecord/test/fixtures/example.log b/activerecord/test/fixtures/example.log deleted file mode 100644 index f084369d8c..0000000000 --- a/activerecord/test/fixtures/example.log +++ /dev/null @@ -1 +0,0 @@ -# Logfile created on Wed Oct 31 16:05:13 +0000 2007 by logger.rb/1.5.2.9 diff --git a/activerecord/test/fixtures/flowers.jpg b/activerecord/test/fixtures/flowers.jpg Binary files differdeleted file mode 100644 index fe9df546df..0000000000 --- a/activerecord/test/fixtures/flowers.jpg +++ /dev/null diff --git a/activerecord/test/fixtures/item.rb b/activerecord/test/fixtures/item.rb deleted file mode 100644 index c2571dd7fb..0000000000 --- a/activerecord/test/fixtures/item.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AbstractItem < ActiveRecord::Base - self.abstract_class = true - has_one :tagging, :as => :taggable -end - -class Item < AbstractItem -end diff --git a/activerecord/test/fixtures/joke.rb b/activerecord/test/fixtures/joke.rb deleted file mode 100644 index 3978abc2ba..0000000000 --- a/activerecord/test/fixtures/joke.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Joke < ActiveRecord::Base - set_table_name 'funny_jokes' -end diff --git a/activerecord/test/fixtures/keyboard.rb b/activerecord/test/fixtures/keyboard.rb deleted file mode 100644 index 32a4a7fad0..0000000000 --- a/activerecord/test/fixtures/keyboard.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Keyboard < ActiveRecord::Base - set_primary_key 'key_number' -end diff --git a/activerecord/test/fixtures/legacy_thing.rb b/activerecord/test/fixtures/legacy_thing.rb deleted file mode 100644 index eaeb642d12..0000000000 --- a/activerecord/test/fixtures/legacy_thing.rb +++ /dev/null @@ -1,3 +0,0 @@ -class LegacyThing < ActiveRecord::Base - set_locking_column :version -end diff --git a/activerecord/test/fixtures/matey.rb b/activerecord/test/fixtures/matey.rb deleted file mode 100644 index 47b0baa974..0000000000 --- a/activerecord/test/fixtures/matey.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Matey < ActiveRecord::Base - belongs_to :pirate - belongs_to :target, :class_name => 'Pirate' -end diff --git a/activerecord/test/fixtures/minimalistic.rb b/activerecord/test/fixtures/minimalistic.rb deleted file mode 100644 index 2e3f8e081a..0000000000 --- a/activerecord/test/fixtures/minimalistic.rb +++ /dev/null @@ -1,2 +0,0 @@ -class Minimalistic < ActiveRecord::Base -end diff --git a/activerecord/test/fixtures/mixed_case_monkey.rb b/activerecord/test/fixtures/mixed_case_monkey.rb deleted file mode 100644 index 853f2682b3..0000000000 --- a/activerecord/test/fixtures/mixed_case_monkey.rb +++ /dev/null @@ -1,3 +0,0 @@ -class MixedCaseMonkey < ActiveRecord::Base - set_primary_key 'monkeyID' -end diff --git a/activerecord/test/fixtures/movie.rb b/activerecord/test/fixtures/movie.rb deleted file mode 100644 index 6384b4c801..0000000000 --- a/activerecord/test/fixtures/movie.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Movie < ActiveRecord::Base - def self.primary_key - "movieid" - end -end diff --git a/activerecord/test/fixtures/order.rb b/activerecord/test/fixtures/order.rb deleted file mode 100644 index ba114f22c6..0000000000 --- a/activerecord/test/fixtures/order.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Order < ActiveRecord::Base - belongs_to :billing, :class_name => 'Customer', :foreign_key => 'billing_customer_id' - belongs_to :shipping, :class_name => 'Customer', :foreign_key => 'shipping_customer_id' -end diff --git a/activerecord/test/fixtures/parrot.rb b/activerecord/test/fixtures/parrot.rb deleted file mode 100644 index 65191c1aa5..0000000000 --- a/activerecord/test/fixtures/parrot.rb +++ /dev/null @@ -1,13 +0,0 @@ -class Parrot < ActiveRecord::Base - set_inheritance_column :parrot_sti_class - has_and_belongs_to_many :pirates - has_and_belongs_to_many :treasures - has_many :loots, :as => :looter -end - -class LiveParrot < Parrot -end - -class DeadParrot < Parrot - belongs_to :killer, :class_name => 'Pirate' -end diff --git a/activerecord/test/fixtures/person.rb b/activerecord/test/fixtures/person.rb deleted file mode 100644 index 7a9666f4eb..0000000000 --- a/activerecord/test/fixtures/person.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Person < ActiveRecord::Base - has_many :readers - has_many :posts, :through => :readers -end diff --git a/activerecord/test/fixtures/pirate.rb b/activerecord/test/fixtures/pirate.rb deleted file mode 100644 index f7193dfbe0..0000000000 --- a/activerecord/test/fixtures/pirate.rb +++ /dev/null @@ -1,5 +0,0 @@ -class Pirate < ActiveRecord::Base - belongs_to :parrot - has_and_belongs_to_many :parrots - has_many :loots, :as => :looter -end diff --git a/activerecord/test/fixtures/post.rb b/activerecord/test/fixtures/post.rb deleted file mode 100644 index 4627da5206..0000000000 --- a/activerecord/test/fixtures/post.rb +++ /dev/null @@ -1,59 +0,0 @@ -class Post < ActiveRecord::Base - belongs_to :author do - def greeting - "hello" - end - end - - belongs_to :author_with_posts, :class_name => "Author", :foreign_key => :author_id, :include => :posts - - has_many :comments, :order => "body" do - def find_most_recent - find(:first, :order => "id DESC") - end - end - - has_one :very_special_comment - has_one :very_special_comment_with_post, :class_name => "VerySpecialComment", :include => :post - has_many :special_comments - has_many :nonexistant_comments, :class_name => 'Comment', :conditions => 'comments.id < 0' - - has_and_belongs_to_many :categories - has_and_belongs_to_many :special_categories, :join_table => "categories_posts", :association_foreign_key => 'category_id' - - has_many :taggings, :as => :taggable - has_many :tags, :through => :taggings, :include => :tagging do - def add_joins_and_select - find :all, :select => 'tags.*, authors.id as author_id', :include => false, - :joins => 'left outer join posts on taggings.taggable_id = posts.id left outer join authors on posts.author_id = authors.id' - end - end - - has_many :funky_tags, :through => :taggings, :source => :tag - has_many :super_tags, :through => :taggings - has_one :tagging, :as => :taggable - - has_many :invalid_taggings, :as => :taggable, :class_name => "Tagging", :conditions => 'taggings.id < 0' - has_many :invalid_tags, :through => :invalid_taggings, :source => :tag - - has_many :categorizations, :foreign_key => :category_id - has_many :authors, :through => :categorizations - - has_many :readers - has_many :people, :through => :readers - - def self.what_are_you - 'a post...' - end -end - -class SpecialPost < Post; end - -class StiPost < Post - self.abstract_class = true - has_one :special_comment, :class_name => "SpecialComment" -end - -class SubStiPost < StiPost - self.table_name = Post.table_name -end diff --git a/activerecord/test/fixtures/project.rb b/activerecord/test/fixtures/project.rb deleted file mode 100644 index b90d2c6fbc..0000000000 --- a/activerecord/test/fixtures/project.rb +++ /dev/null @@ -1,28 +0,0 @@ -class Project < ActiveRecord::Base - has_and_belongs_to_many :developers, :uniq => true, :order => 'developers.name desc, developers.id desc' - has_and_belongs_to_many :selected_developers, :class_name => "Developer", :select => "developers.*", :uniq => true - has_and_belongs_to_many :non_unique_developers, :order => 'developers.name desc, developers.id desc', :class_name => 'Developer' - has_and_belongs_to_many :limited_developers, :class_name => "Developer", :limit => 1 - has_and_belongs_to_many :developers_named_david, :class_name => "Developer", :conditions => "name = 'David'", :uniq => true - has_and_belongs_to_many :developers_named_david_with_hash_conditions, :class_name => "Developer", :conditions => { :name => 'David' }, :uniq => true - has_and_belongs_to_many :salaried_developers, :class_name => "Developer", :conditions => "salary > 0" - has_and_belongs_to_many :developers_with_finder_sql, :class_name => "Developer", :finder_sql => 'SELECT t.*, j.* FROM developers_projects j, developers t WHERE t.id = j.developer_id AND j.project_id = #{id}' - has_and_belongs_to_many :developers_by_sql, :class_name => "Developer", :delete_sql => "DELETE FROM developers_projects WHERE project_id = \#{id} AND developer_id = \#{record.id}" - has_and_belongs_to_many :developers_with_callbacks, :class_name => "Developer", :before_add => Proc.new {|o, r| o.developers_log << "before_adding#{r.id || '<new>'}"}, - :after_add => Proc.new {|o, r| o.developers_log << "after_adding#{r.id || '<new>'}"}, - :before_remove => Proc.new {|o, r| o.developers_log << "before_removing#{r.id}"}, - :after_remove => Proc.new {|o, r| o.developers_log << "after_removing#{r.id}"} - - attr_accessor :developers_log - - def after_initialize - @developers_log = [] - end - -end - -class SpecialProject < Project - def hello_world - "hello there!" - end -end diff --git a/activerecord/test/fixtures/reader.rb b/activerecord/test/fixtures/reader.rb deleted file mode 100644 index 27527bf566..0000000000 --- a/activerecord/test/fixtures/reader.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Reader < ActiveRecord::Base - belongs_to :post - belongs_to :person -end diff --git a/activerecord/test/fixtures/reply.rb b/activerecord/test/fixtures/reply.rb deleted file mode 100755 index bf7781e814..0000000000 --- a/activerecord/test/fixtures/reply.rb +++ /dev/null @@ -1,37 +0,0 @@ -require 'fixtures/topic' - -class Reply < Topic - belongs_to :topic, :foreign_key => "parent_id", :counter_cache => true - has_many :replies, :class_name => "SillyReply", :dependent => :destroy, :foreign_key => "parent_id" - - validate :errors_on_empty_content - validate_on_create :title_is_wrong_create - - attr_accessible :title, :author_name, :author_email_address, :written_on, :content, :last_read - - def validate - errors.add("title", "Empty") unless attribute_present? "title" - end - - def errors_on_empty_content - errors.add("content", "Empty") unless attribute_present? "content" - end - - def validate_on_create - if attribute_present?("title") && attribute_present?("content") && content == "Mismatch" - errors.add("title", "is Content Mismatch") - end - end - - def title_is_wrong_create - errors.add("title", "is Wrong Create") if attribute_present?("title") && title == "Wrong Create" - end - - def validate_on_update - errors.add("title", "is Wrong Update") if attribute_present?("title") && title == "Wrong Update" - end -end - -class SillyReply < Reply - belongs_to :reply, :foreign_key => "parent_id", :counter_cache => :replies_count -end diff --git a/activerecord/test/fixtures/ship.rb b/activerecord/test/fixtures/ship.rb deleted file mode 100644 index 05b09fc1b9..0000000000 --- a/activerecord/test/fixtures/ship.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Ship < ActiveRecord::Base - self.record_timestamps = false -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/subject.rb b/activerecord/test/fixtures/subject.rb deleted file mode 100644 index 3502943f3a..0000000000 --- a/activerecord/test/fixtures/subject.rb +++ /dev/null @@ -1,4 +0,0 @@ -# used for OracleSynonymTest, see test/synonym_test_oci.rb -# -class Subject < ActiveRecord::Base -end diff --git a/activerecord/test/fixtures/subscriber.rb b/activerecord/test/fixtures/subscriber.rb deleted file mode 100644 index 51335a8f20..0000000000 --- a/activerecord/test/fixtures/subscriber.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Subscriber < ActiveRecord::Base - set_primary_key 'nick' -end - -class SpecialSubscriber < Subscriber -end diff --git a/activerecord/test/fixtures/tag.rb b/activerecord/test/fixtures/tag.rb deleted file mode 100644 index a581b381e8..0000000000 --- a/activerecord/test/fixtures/tag.rb +++ /dev/null @@ -1,7 +0,0 @@ -class Tag < ActiveRecord::Base - has_many :taggings - has_many :taggables, :through => :taggings - has_one :tagging - - has_many :tagged_posts, :through => :taggings, :source => :taggable, :source_type => 'Post' -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/tagging.rb b/activerecord/test/fixtures/tagging.rb deleted file mode 100644 index a1fa1a9750..0000000000 --- a/activerecord/test/fixtures/tagging.rb +++ /dev/null @@ -1,10 +0,0 @@ -# test that attr_readonly isn't called on the :taggable polymorphic association -module Taggable -end - -class Tagging < ActiveRecord::Base - belongs_to :tag, :include => :tagging - belongs_to :super_tag, :class_name => 'Tag', :foreign_key => 'super_tag_id' - belongs_to :invalid_tag, :class_name => 'Tag', :foreign_key => 'tag_id' - belongs_to :taggable, :polymorphic => true, :counter_cache => true -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/task.rb b/activerecord/test/fixtures/task.rb deleted file mode 100644 index ee0282c79b..0000000000 --- a/activerecord/test/fixtures/task.rb +++ /dev/null @@ -1,3 +0,0 @@ -class Task < ActiveRecord::Base - -end diff --git a/activerecord/test/fixtures/topic.rb b/activerecord/test/fixtures/topic.rb deleted file mode 100755 index b2541c8640..0000000000 --- a/activerecord/test/fixtures/topic.rb +++ /dev/null @@ -1,37 +0,0 @@ -class Topic < ActiveRecord::Base - has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" - serialize :content - - before_create :default_written_on - before_destroy :destroy_children - - def parent - Topic.find(parent_id) - end - - # trivial method for testing Array#to_xml with :methods - def topic_id - id - end - - - protected - def approved=(val) - @custom_approved = val - write_attribute(:approved, val) - end - - def default_written_on - self.written_on = Time.now unless attribute_present?("written_on") - end - - def destroy_children - self.class.delete_all "parent_id = #{id}" - end - - def after_initialize - if self.new_record? - self.author_email_address = 'test@test.com' - end - end -end
\ No newline at end of file diff --git a/activerecord/test/fixtures/treasure.rb b/activerecord/test/fixtures/treasure.rb deleted file mode 100644 index 7a429e2a2f..0000000000 --- a/activerecord/test/fixtures/treasure.rb +++ /dev/null @@ -1,4 +0,0 @@ -class Treasure < ActiveRecord::Base - has_and_belongs_to_many :parrots - belongs_to :looter, :polymorphic => true -end diff --git a/activerecord/test/fixtures/vertex.rb b/activerecord/test/fixtures/vertex.rb deleted file mode 100644 index 48bb851e62..0000000000 --- a/activerecord/test/fixtures/vertex.rb +++ /dev/null @@ -1,9 +0,0 @@ -# This class models a vertex in a directed graph. -class Vertex < ActiveRecord::Base - has_many :sink_edges, :class_name => 'Edge', :foreign_key => 'source_id' - has_many :sinks, :through => :sink_edges - - has_and_belongs_to_many :sources, - :class_name => 'Vertex', :join_table => 'edges', - :foreign_key => 'sink_id', :association_foreign_key => 'source_id' -end diff --git a/activerecord/test/fixtures/warehouse_thing.rb b/activerecord/test/fixtures/warehouse_thing.rb deleted file mode 100644 index 6ace1183cc..0000000000 --- a/activerecord/test/fixtures/warehouse_thing.rb +++ /dev/null @@ -1,5 +0,0 @@ -class WarehouseThing < ActiveRecord::Base - set_table_name "warehouse-things" - - validates_uniqueness_of :value -end
\ No newline at end of file |