activerecord-nuodb-adapter 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.DS_Store +0 -0
- data/.travis.yml +26 -2
- data/{CONTRIBUTION.rdoc → CONTRIBUTION.md} +16 -15
- data/Gemfile +1 -1
- data/README.md +48 -0
- data/active_setup_linux.sh +97 -0
- data/activerecord-nuodb-adapter.gemspec +1 -1
- data/lib/active_record/connection_adapters/nuodb/version.rb +1 -1
- data/lib/active_record/connection_adapters/nuodb_adapter.rb +45 -9
- data/test/.DS_Store +0 -0
- data/test/.gitignore +1 -0
- data/test/active_record/connection_adapters/fake_adapter.rb +45 -0
- data/test/ar_schema_test.rb +70 -0
- data/test/assets/example.log +1 -0
- data/test/assets/flowers.jpg +0 -0
- data/test/assets/test.txt +1 -0
- data/test/base_test.rb +1481 -0
- data/test/cases/.DS_Store +0 -0
- data/test/cases/adapter_test.rb +211 -0
- data/test/cases/adapters/firebird/connection_test.rb +8 -0
- data/test/cases/adapters/firebird/default_test.rb +16 -0
- data/test/cases/adapters/firebird/migration_test.rb +124 -0
- data/test/cases/adapters/mysql/active_schema_test.rb +143 -0
- data/test/cases/adapters/mysql/case_sensitivity_test.rb +35 -0
- data/test/cases/adapters/mysql/connection_test.rb +172 -0
- data/test/cases/adapters/mysql/enum_test.rb +10 -0
- data/test/cases/adapters/mysql/mysql_adapter_test.rb +125 -0
- data/test/cases/adapters/mysql/quoting_test.rb +25 -0
- data/test/cases/adapters/mysql/reserved_word_test.rb +153 -0
- data/test/cases/adapters/mysql/schema_test.rb +62 -0
- data/test/cases/adapters/mysql/sp_test.rb +15 -0
- data/test/cases/adapters/mysql/sql_types_test.rb +14 -0
- data/test/cases/adapters/mysql/statement_pool_test.rb +23 -0
- data/test/cases/adapters/mysql2/active_schema_test.rb +143 -0
- data/test/cases/adapters/mysql2/bind_parameter_test.rb +50 -0
- data/test/cases/adapters/mysql2/case_sensitivity_test.rb +35 -0
- data/test/cases/adapters/mysql2/connection_test.rb +97 -0
- data/test/cases/adapters/mysql2/enum_test.rb +10 -0
- data/test/cases/adapters/mysql2/explain_test.rb +26 -0
- data/test/cases/adapters/mysql2/reserved_word_test.rb +152 -0
- data/test/cases/adapters/mysql2/schema_migrations_test.rb +26 -0
- data/test/cases/adapters/mysql2/schema_test.rb +70 -0
- data/test/cases/adapters/mysql2/sql_types_test.rb +14 -0
- data/test/cases/adapters/oracle/synonym_test.rb +17 -0
- data/test/cases/adapters/postgresql/active_schema_test.rb +58 -0
- data/test/cases/adapters/postgresql/array_test.rb +104 -0
- data/test/cases/adapters/postgresql/bytea_test.rb +104 -0
- data/test/cases/adapters/postgresql/connection_test.rb +163 -0
- data/test/cases/adapters/postgresql/datatype_test.rb +604 -0
- data/test/cases/adapters/postgresql/explain_test.rb +28 -0
- data/test/cases/adapters/postgresql/hstore_test.rb +200 -0
- data/test/cases/adapters/postgresql/json_test.rb +99 -0
- data/test/cases/adapters/postgresql/ltree_test.rb +41 -0
- data/test/cases/adapters/postgresql/postgresql_adapter_test.rb +288 -0
- data/test/cases/adapters/postgresql/quoting_test.rb +58 -0
- data/test/cases/adapters/postgresql/schema_authorization_test.rb +114 -0
- data/test/cases/adapters/postgresql/schema_test.rb +376 -0
- data/test/cases/adapters/postgresql/sql_types_test.rb +18 -0
- data/test/cases/adapters/postgresql/statement_pool_test.rb +39 -0
- data/test/cases/adapters/postgresql/timestamp_test.rb +113 -0
- data/test/cases/adapters/postgresql/utils_test.rb +20 -0
- data/test/cases/adapters/postgresql/uuid_test.rb +95 -0
- data/test/cases/adapters/postgresql/view_test.rb +49 -0
- data/test/cases/adapters/sqlite3/copy_table_test.rb +99 -0
- data/test/cases/adapters/sqlite3/explain_test.rb +26 -0
- data/test/cases/adapters/sqlite3/quoting_test.rb +102 -0
- data/test/cases/adapters/sqlite3/sqlite3_adapter_test.rb +366 -0
- data/test/cases/adapters/sqlite3/statement_pool_test.rb +24 -0
- data/test/cases/aggregations_test.rb +158 -0
- data/test/cases/ar_schema_test.rb +70 -0
- data/test/cases/associations/association_scope_test.rb +15 -0
- data/test/cases/associations/belongs_to_associations_test.rb +831 -0
- data/test/cases/associations/callbacks_test.rb +168 -0
- data/test/cases/associations/cascaded_eager_loading_test.rb +179 -0
- data/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/test/cases/associations/eager_load_nested_include_test.rb +128 -0
- data/test/cases/associations/eager_singularization_test.rb +145 -0
- data/test/cases/associations/eager_test.rb +1179 -0
- data/test/cases/associations/extension_test.rb +80 -0
- data/test/cases/associations/has_and_belongs_to_many_associations_test.rb +779 -0
- data/test/cases/associations/has_many_associations_test.rb +1699 -0
- data/test/cases/associations/has_many_through_associations_test.rb +950 -0
- data/test/cases/associations/has_one_associations_test.rb +525 -0
- data/test/cases/associations/has_one_through_associations_test.rb +317 -0
- data/test/cases/associations/inner_join_association_test.rb +115 -0
- data/test/cases/associations/inverse_associations_test.rb +631 -0
- data/test/cases/associations/join_dependency_test.rb +8 -0
- data/test/cases/associations/join_model_test.rb +750 -0
- data/test/cases/associations/nested_through_associations_test.rb +575 -0
- data/test/cases/associations_test.rb +344 -0
- data/test/cases/attribute_methods/read_test.rb +58 -0
- data/test/cases/attribute_methods/serialization_test.rb +29 -0
- data/test/cases/attribute_methods_test.rb +819 -0
- data/test/cases/autosave_association_test.rb +1447 -0
- data/test/cases/base_test.rb +1481 -0
- data/test/cases/batches_test.rb +173 -0
- data/test/cases/binary_test.rb +49 -0
- data/test/cases/bind_parameter_test.rb +89 -0
- data/test/cases/calculations_test.rb +589 -0
- data/test/cases/callbacks_test.rb +535 -0
- data/test/cases/clone_test.rb +40 -0
- data/test/cases/coders/yaml_column_test.rb +63 -0
- data/test/cases/column_alias_test.rb +17 -0
- data/test/cases/column_definition_test.rb +143 -0
- data/test/cases/column_test.rb +115 -0
- data/test/cases/connection_adapters/abstract_adapter_test.rb +62 -0
- data/test/cases/connection_adapters/connection_handler_test.rb +53 -0
- data/test/cases/connection_adapters/connection_specification_test.rb +12 -0
- data/test/cases/connection_adapters/quoting_test.rb +13 -0
- data/test/cases/connection_adapters/schema_cache_test.rb +56 -0
- data/test/cases/connection_management_test.rb +112 -0
- data/test/cases/connection_pool_test.rb +344 -0
- data/test/cases/connection_specification/resolver_test.rb +63 -0
- data/test/cases/core_test.rb +33 -0
- data/test/cases/counter_cache_test.rb +163 -0
- data/test/cases/custom_locking_test.rb +17 -0
- data/test/cases/database_statements_test.rb +19 -0
- data/test/cases/date_time_test.rb +43 -0
- data/test/cases/defaults_test.rb +214 -0
- data/test/cases/dirty_test.rb +626 -0
- data/test/cases/disconnected_test.rb +27 -0
- data/test/cases/dup_test.rb +136 -0
- data/test/cases/explain_subscriber_test.rb +59 -0
- data/test/cases/explain_test.rb +72 -0
- data/test/cases/finder_respond_to_test.rb +50 -0
- data/test/cases/finder_test.rb +886 -0
- data/test/cases/fixture_set/file_test.rb +83 -0
- data/test/cases/fixtures_test.rb +808 -0
- data/test/cases/forbidden_attributes_protection_test.rb +64 -0
- data/test/cases/habtm_destroy_order_test.rb +61 -0
- data/test/cases/helper.rb +151 -0
- data/test/cases/hot_compatibility_test.rb +54 -0
- data/test/cases/i18n_test.rb +45 -0
- data/test/cases/inheritance_test.rb +355 -0
- data/test/cases/integration_test.rb +87 -0
- data/test/cases/invalid_connection_test.rb +22 -0
- data/test/cases/invalid_date_test.rb +32 -0
- data/test/cases/invertible_migration_test.rb +259 -0
- data/test/cases/json_serialization_test.rb +300 -0
- data/test/cases/locking_test.rb +453 -0
- data/test/cases/log_subscriber_test.rb +129 -0
- data/test/cases/migration/change_schema_test.rb +379 -0
- data/test/cases/migration/change_table_test.rb +204 -0
- data/test/cases/migration/column_attributes_test.rb +186 -0
- data/test/cases/migration/column_positioning_test.rb +60 -0
- data/test/cases/migration/columns_test.rb +279 -0
- data/test/cases/migration/command_recorder_test.rb +247 -0
- data/test/cases/migration/create_join_table_test.rb +125 -0
- data/test/cases/migration/helper.rb +43 -0
- data/test/cases/migration/index_test.rb +209 -0
- data/test/cases/migration/logger_test.rb +37 -0
- data/test/cases/migration/references_index_test.rb +102 -0
- data/test/cases/migration/references_statements_test.rb +111 -0
- data/test/cases/migration/rename_table_test.rb +90 -0
- data/test/cases/migration/table_and_index_test.rb +24 -0
- data/test/cases/migration_test.rb +861 -0
- data/test/cases/migrator_test.rb +378 -0
- data/test/cases/mixin_test.rb +96 -0
- data/test/cases/modules_test.rb +143 -0
- data/test/cases/multiparameter_attributes_test.rb +350 -0
- data/test/cases/multiple_db_test.rb +108 -0
- data/test/cases/nested_attributes_test.rb +1056 -0
- data/test/cases/persistence_test.rb +802 -0
- data/test/cases/pooled_connections_test.rb +51 -0
- data/test/cases/primary_keys_test.rb +218 -0
- data/test/cases/query_cache_test.rb +276 -0
- data/test/cases/quoting_test.rb +229 -0
- data/test/cases/readonly_test.rb +111 -0
- data/test/cases/reaper_test.rb +81 -0
- data/test/cases/reflection_test.rb +386 -0
- data/test/cases/relation/where_chain_test.rb +80 -0
- data/test/cases/relation/where_test.rb +120 -0
- data/test/cases/relation_test.rb +315 -0
- data/test/cases/relations_test.rb +1559 -0
- data/test/cases/reload_models_test.rb +22 -0
- data/test/cases/result_test.rb +32 -0
- data/test/cases/sanitize_test.rb +34 -0
- data/test/cases/schema_dumper_test.rb +391 -0
- data/test/cases/scoping/default_scoping_test.rb +374 -0
- data/test/cases/scoping/named_scoping_test.rb +451 -0
- data/test/cases/scoping/relation_scoping_test.rb +331 -0
- data/test/cases/serialization_test.rb +68 -0
- data/test/cases/serialized_attribute_test.rb +252 -0
- data/test/cases/statement_cache_test.rb +64 -0
- data/test/cases/store_test.rb +153 -0
- data/test/cases/tasks/database_tasks_test.rb +315 -0
- data/test/cases/tasks/mysql_rake_test.rb +301 -0
- data/test/cases/tasks/postgresql_rake_test.rb +236 -0
- data/test/cases/tasks/sqlite_rake_test.rb +191 -0
- data/test/cases/test_case.rb +95 -0
- data/test/cases/test_simple.rb +194 -0
- data/test/cases/timestamp_test.rb +308 -0
- data/test/cases/transaction_callbacks_test.rb +317 -0
- data/test/cases/transaction_isolation_test.rb +114 -0
- data/test/cases/transactions_test.rb +595 -0
- data/test/cases/unconnected_test.rb +33 -0
- data/test/cases/validations/association_validation_test.rb +121 -0
- data/test/cases/validations/i18n_generate_message_validation_test.rb +76 -0
- data/test/cases/validations/i18n_validation_test.rb +89 -0
- data/test/cases/validations/presence_validation_test.rb +51 -0
- data/test/cases/validations/uniqueness_validation_test.rb +379 -0
- data/test/cases/validations_repair_helper.rb +23 -0
- data/test/cases/validations_test.rb +124 -0
- data/test/cases/xml_serialization_test.rb +455 -0
- data/test/cases/yaml_serialization_test.rb +52 -0
- data/test/config.example.yml +154 -0
- data/test/config.rb +5 -0
- data/test/database_statements_test.rb +19 -0
- data/test/fixtures/.gitignore +1 -0
- data/test/fixtures/accounts.yml +29 -0
- data/test/fixtures/admin/accounts.yml +2 -0
- data/test/fixtures/admin/randomly_named_a9.yml +7 -0
- data/test/fixtures/admin/randomly_named_b0.yml +7 -0
- data/test/fixtures/admin/users.yml +10 -0
- data/test/fixtures/all/developers.yml +0 -0
- data/test/fixtures/all/people.yml +0 -0
- data/test/fixtures/all/tasks.yml +0 -0
- data/test/fixtures/author_addresses.yml +5 -0
- data/test/fixtures/author_favorites.yml +4 -0
- data/test/fixtures/authors.yml +15 -0
- data/test/fixtures/binaries.yml +133 -0
- data/test/fixtures/books.yml +9 -0
- data/test/fixtures/cars.yml +9 -0
- data/test/fixtures/categories.yml +19 -0
- data/test/fixtures/categories/special_categories.yml +9 -0
- data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/test/fixtures/categories_ordered.yml +7 -0
- data/test/fixtures/categories_posts.yml +31 -0
- data/test/fixtures/categorizations.yml +23 -0
- data/test/fixtures/clubs.yml +8 -0
- data/test/fixtures/collections.yml +3 -0
- data/test/fixtures/colleges.yml +3 -0
- data/test/fixtures/comments.yml +65 -0
- data/test/fixtures/companies.yml +59 -0
- data/test/fixtures/computers.yml +4 -0
- data/test/fixtures/courses.yml +8 -0
- data/test/fixtures/customers.yml +26 -0
- data/test/fixtures/dashboards.yml +6 -0
- data/test/fixtures/developers.yml +21 -0
- data/test/fixtures/developers_projects.yml +17 -0
- data/test/fixtures/dog_lovers.yml +7 -0
- data/test/fixtures/dogs.yml +4 -0
- data/test/fixtures/edges.yml +5 -0
- data/test/fixtures/entrants.yml +14 -0
- data/test/fixtures/essays.yml +6 -0
- data/test/fixtures/faces.yml +11 -0
- data/test/fixtures/fk_test_has_fk.yml +3 -0
- data/test/fixtures/fk_test_has_pk.yml +2 -0
- data/test/fixtures/friendships.yml +4 -0
- data/test/fixtures/funny_jokes.yml +10 -0
- data/test/fixtures/interests.yml +33 -0
- data/test/fixtures/items.yml +3 -0
- data/test/fixtures/jobs.yml +7 -0
- data/test/fixtures/legacy_things.yml +3 -0
- data/test/fixtures/mateys.yml +4 -0
- data/test/fixtures/member_details.yml +8 -0
- data/test/fixtures/member_types.yml +6 -0
- data/test/fixtures/members.yml +11 -0
- data/test/fixtures/memberships.yml +34 -0
- data/test/fixtures/men.yml +5 -0
- data/test/fixtures/minimalistics.yml +2 -0
- data/test/fixtures/minivans.yml +5 -0
- data/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/test/fixtures/mixins.yml +29 -0
- data/test/fixtures/movies.yml +7 -0
- data/test/fixtures/naked/csv/accounts.csv +1 -0
- data/test/fixtures/naked/yml/accounts.yml +1 -0
- data/test/fixtures/naked/yml/companies.yml +1 -0
- data/test/fixtures/naked/yml/courses.yml +1 -0
- data/test/fixtures/organizations.yml +5 -0
- data/test/fixtures/other_topics.yml +42 -0
- data/test/fixtures/owners.yml +8 -0
- data/test/fixtures/parrots.yml +27 -0
- data/test/fixtures/parrots_pirates.yml +7 -0
- data/test/fixtures/people.yml +24 -0
- data/test/fixtures/peoples_treasures.yml +3 -0
- data/test/fixtures/pets.yml +19 -0
- data/test/fixtures/pirates.yml +9 -0
- data/test/fixtures/posts.yml +82 -0
- data/test/fixtures/price_estimates.yml +7 -0
- data/test/fixtures/products.yml +4 -0
- data/test/fixtures/projects.yml +7 -0
- data/test/fixtures/randomly_named_a9.yml +7 -0
- data/test/fixtures/ratings.yml +14 -0
- data/test/fixtures/readers.yml +11 -0
- data/test/fixtures/references.yml +17 -0
- data/test/fixtures/reserved_words/distinct.yml +5 -0
- data/test/fixtures/reserved_words/distinct_select.yml +11 -0
- data/test/fixtures/reserved_words/group.yml +14 -0
- data/test/fixtures/reserved_words/select.yml +8 -0
- data/test/fixtures/reserved_words/values.yml +7 -0
- data/test/fixtures/ships.yml +6 -0
- data/test/fixtures/speedometers.yml +8 -0
- data/test/fixtures/sponsors.yml +12 -0
- data/test/fixtures/string_key_objects.yml +7 -0
- data/test/fixtures/subscribers.yml +11 -0
- data/test/fixtures/subscriptions.yml +12 -0
- data/test/fixtures/taggings.yml +78 -0
- data/test/fixtures/tags.yml +11 -0
- data/test/fixtures/tasks.yml +7 -0
- data/test/fixtures/teapots.yml +3 -0
- data/test/fixtures/topics.yml +42 -0
- data/test/fixtures/toys.yml +14 -0
- data/test/fixtures/traffic_lights.yml +10 -0
- data/test/fixtures/treasures.yml +10 -0
- data/test/fixtures/variants.yml +4 -0
- data/test/fixtures/vegetables.yml +20 -0
- data/test/fixtures/vertices.yml +4 -0
- data/test/fixtures/warehouse-things.yml +3 -0
- data/test/fixtures/zines.yml +5 -0
- data/test/migration_test.rb +861 -0
- data/test/migrations/10_urban/9_add_expressions.rb +11 -0
- data/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/test/migrations/empty/.gitkeep +0 -0
- data/test/migrations/magic/1_currencies_have_symbols.rb +12 -0
- data/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/test/migrations/rename/1_we_need_things.rb +11 -0
- data/test/migrations/rename/2_rename_things.rb +9 -0
- data/test/migrations/to_copy/1_people_have_hobbies.rb +9 -0
- data/test/migrations/to_copy/2_people_have_descriptions.rb +9 -0
- data/test/migrations/to_copy2/1_create_articles.rb +7 -0
- data/test/migrations/to_copy2/2_create_comments.rb +7 -0
- data/test/migrations/to_copy_with_name_collision/1_people_have_hobbies.rb +9 -0
- data/test/migrations/to_copy_with_timestamps/20090101010101_people_have_hobbies.rb +9 -0
- data/test/migrations/to_copy_with_timestamps/20090101010202_people_have_descriptions.rb +9 -0
- data/test/migrations/to_copy_with_timestamps2/20090101010101_create_articles.rb +7 -0
- data/test/migrations/to_copy_with_timestamps2/20090101010202_create_comments.rb +7 -0
- data/test/migrations/valid/1_valid_people_have_last_names.rb +9 -0
- data/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/test/migrations/valid_with_subdirectories/1_valid_people_have_last_names.rb +9 -0
- data/test/migrations/valid_with_subdirectories/sub/2_we_need_reminders.rb +12 -0
- data/test/migrations/valid_with_subdirectories/sub1/3_innocent_jointable.rb +12 -0
- data/test/migrations/valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb +9 -0
- data/test/migrations/valid_with_timestamps/20100201010101_valid_with_timestamps_we_need_reminders.rb +12 -0
- data/test/migrations/valid_with_timestamps/20100301010101_valid_with_timestamps_innocent_jointable.rb +12 -0
- data/test/models/admin.rb +5 -0
- data/test/models/admin/account.rb +3 -0
- data/test/models/admin/randomly_named_c1.rb +3 -0
- data/test/models/admin/user.rb +39 -0
- data/test/models/aircraft.rb +4 -0
- data/test/models/arunit2_model.rb +3 -0
- data/test/models/author.rb +196 -0
- data/test/models/auto_id.rb +4 -0
- data/test/models/autoloadable/extra_firm.rb +2 -0
- data/test/models/binary.rb +2 -0
- data/test/models/bird.rb +12 -0
- data/test/models/book.rb +9 -0
- data/test/models/boolean.rb +2 -0
- data/test/models/bulb.rb +45 -0
- data/test/models/car.rb +28 -0
- data/test/models/categorization.rb +19 -0
- data/test/models/category.rb +34 -0
- data/test/models/citation.rb +6 -0
- data/test/models/club.rb +15 -0
- data/test/models/college.rb +5 -0
- data/test/models/column_name.rb +3 -0
- data/test/models/comment.rb +38 -0
- data/test/models/company.rb +214 -0
- data/test/models/company_in_module.rb +80 -0
- data/test/models/computer.rb +3 -0
- data/test/models/contact.rb +40 -0
- data/test/models/contract.rb +19 -0
- data/test/models/country.rb +7 -0
- data/test/models/course.rb +6 -0
- data/test/models/customer.rb +77 -0
- data/test/models/dashboard.rb +3 -0
- data/test/models/default.rb +2 -0
- data/test/models/developer.rb +250 -0
- data/test/models/dog.rb +5 -0
- data/test/models/dog_lover.rb +5 -0
- data/test/models/edge.rb +5 -0
- data/test/models/electron.rb +3 -0
- data/test/models/engine.rb +4 -0
- data/test/models/entrant.rb +3 -0
- data/test/models/essay.rb +5 -0
- data/test/models/event.rb +3 -0
- data/test/models/eye.rb +37 -0
- data/test/models/face.rb +7 -0
- data/test/models/friendship.rb +6 -0
- data/test/models/guid.rb +2 -0
- data/test/models/interest.rb +5 -0
- data/test/models/invoice.rb +4 -0
- data/test/models/item.rb +7 -0
- data/test/models/job.rb +7 -0
- data/test/models/joke.rb +7 -0
- data/test/models/keyboard.rb +3 -0
- data/test/models/legacy_thing.rb +3 -0
- data/test/models/lesson.rb +11 -0
- data/test/models/line_item.rb +3 -0
- data/test/models/liquid.rb +4 -0
- data/test/models/man.rb +9 -0
- data/test/models/matey.rb +4 -0
- data/test/models/member.rb +36 -0
- data/test/models/member_detail.rb +7 -0
- data/test/models/member_type.rb +3 -0
- data/test/models/membership.rb +15 -0
- data/test/models/minimalistic.rb +2 -0
- data/test/models/minivan.rb +9 -0
- data/test/models/mixed_case_monkey.rb +3 -0
- data/test/models/molecule.rb +4 -0
- data/test/models/movie.rb +5 -0
- data/test/models/order.rb +4 -0
- data/test/models/organization.rb +12 -0
- data/test/models/owner.rb +5 -0
- data/test/models/parrot.rb +29 -0
- data/test/models/person.rb +128 -0
- data/test/models/pet.rb +15 -0
- data/test/models/pirate.rb +86 -0
- data/test/models/possession.rb +3 -0
- data/test/models/post.rb +194 -0
- data/test/models/price_estimate.rb +4 -0
- data/test/models/project.rb +30 -0
- data/test/models/randomly_named_c1.rb +3 -0
- data/test/models/rating.rb +4 -0
- data/test/models/reader.rb +21 -0
- data/test/models/reference.rb +22 -0
- data/test/models/reply.rb +61 -0
- data/test/models/ship.rb +19 -0
- data/test/models/ship_part.rb +7 -0
- data/test/models/shop.rb +12 -0
- data/test/models/speedometer.rb +6 -0
- data/test/models/sponsor.rb +7 -0
- data/test/models/string_key_object.rb +3 -0
- data/test/models/student.rb +3 -0
- data/test/models/subject.rb +16 -0
- data/test/models/subscriber.rb +8 -0
- data/test/models/subscription.rb +4 -0
- data/test/models/tag.rb +7 -0
- data/test/models/tagging.rb +13 -0
- data/test/models/task.rb +5 -0
- data/test/models/topic.rb +121 -0
- data/test/models/toy.rb +6 -0
- data/test/models/traffic_light.rb +4 -0
- data/test/models/treasure.rb +11 -0
- data/test/models/treaty.rb +7 -0
- data/test/models/tyre.rb +3 -0
- data/test/models/vegetables.rb +24 -0
- data/test/models/vertex.rb +9 -0
- data/test/models/warehouse_thing.rb +5 -0
- data/test/models/wheel.rb +3 -0
- data/test/models/without_table.rb +3 -0
- data/test/models/zine.rb +3 -0
- data/test/schema/mysql2_specific_schema.rb +58 -0
- data/test/schema/mysql_specific_schema.rb +70 -0
- data/test/schema/oracle_specific_schema.rb +46 -0
- data/test/schema/postgresql_specific_schema.rb +224 -0
- data/test/schema/schema.rb +809 -0
- data/test/schema/sqlite_specific_schema.rb +25 -0
- data/test/support/config.rb +43 -0
- data/test/support/connection.rb +21 -0
- metadata +898 -6
- data/README.rdoc +0 -42
@@ -0,0 +1,64 @@
|
|
1
|
+
require 'cases/helper'
|
2
|
+
require 'models/book'
|
3
|
+
require 'models/liquid'
|
4
|
+
require 'models/molecule'
|
5
|
+
require 'models/electron'
|
6
|
+
|
7
|
+
module ActiveRecord
|
8
|
+
class StatementCacheTest < ActiveRecord::TestCase
|
9
|
+
def setup
|
10
|
+
@connection = ActiveRecord::Base.connection
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_statement_cache_with_simple_statement
|
14
|
+
cache = ActiveRecord::StatementCache.new do
|
15
|
+
Book.where(name: "my book").where("author_id > 3")
|
16
|
+
end
|
17
|
+
|
18
|
+
Book.create(name: "my book", author_id: 4)
|
19
|
+
|
20
|
+
books = cache.execute
|
21
|
+
assert_equal "my book", books[0].name
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_statement_cache_with_nil_statement_raises_error
|
25
|
+
assert_raise(ArgumentError) do
|
26
|
+
ActiveRecord::StatementCache.new do
|
27
|
+
nil
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_statement_cache_with_complex_statement
|
33
|
+
cache = ActiveRecord::StatementCache.new do
|
34
|
+
Liquid.joins(:molecules => :electrons).where('molecules.name' => 'dioxane', 'electrons.name' => 'lepton')
|
35
|
+
end
|
36
|
+
|
37
|
+
salty = Liquid.create(name: 'salty')
|
38
|
+
molecule = salty.molecules.create(name: 'dioxane')
|
39
|
+
molecule.electrons.create(name: 'lepton')
|
40
|
+
|
41
|
+
liquids = cache.execute
|
42
|
+
assert_equal "salty", liquids[0].name
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_statement_cache_values_differ
|
46
|
+
cache = ActiveRecord::StatementCache.new do
|
47
|
+
Book.where(name: "my book")
|
48
|
+
end
|
49
|
+
|
50
|
+
3.times do
|
51
|
+
Book.create(name: "my book")
|
52
|
+
end
|
53
|
+
|
54
|
+
first_books = cache.execute
|
55
|
+
|
56
|
+
3.times do
|
57
|
+
Book.create(name: "my book")
|
58
|
+
end
|
59
|
+
|
60
|
+
additional_books = cache.execute
|
61
|
+
assert first_books != additional_books
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,153 @@
|
|
1
|
+
require 'cases/helper'
|
2
|
+
require 'models/admin'
|
3
|
+
require 'models/admin/user'
|
4
|
+
|
5
|
+
class StoreTest < ActiveRecord::TestCase
|
6
|
+
fixtures :'admin/users'
|
7
|
+
|
8
|
+
setup do
|
9
|
+
@john = Admin::User.create!(:name => 'John Doe', :color => 'black', :remember_login => true, :height => 'tall', :is_a_good_guy => true)
|
10
|
+
end
|
11
|
+
|
12
|
+
test "reading store attributes through accessors" do
|
13
|
+
assert_equal 'black', @john.color
|
14
|
+
assert_nil @john.homepage
|
15
|
+
end
|
16
|
+
|
17
|
+
test "writing store attributes through accessors" do
|
18
|
+
@john.color = 'red'
|
19
|
+
@john.homepage = '37signals.com'
|
20
|
+
|
21
|
+
assert_equal 'red', @john.color
|
22
|
+
assert_equal '37signals.com', @john.homepage
|
23
|
+
end
|
24
|
+
|
25
|
+
test "accessing attributes not exposed by accessors" do
|
26
|
+
@john.settings[:icecream] = 'graeters'
|
27
|
+
@john.save
|
28
|
+
|
29
|
+
assert_equal 'graeters', @john.reload.settings[:icecream]
|
30
|
+
end
|
31
|
+
|
32
|
+
test "overriding a read accessor" do
|
33
|
+
@john.settings[:phone_number] = '1234567890'
|
34
|
+
|
35
|
+
assert_equal '(123) 456-7890', @john.phone_number
|
36
|
+
end
|
37
|
+
|
38
|
+
test "overriding a read accessor using super" do
|
39
|
+
@john.settings[:color] = nil
|
40
|
+
|
41
|
+
assert_equal 'red', @john.color
|
42
|
+
end
|
43
|
+
|
44
|
+
test "updating the store will mark it as changed" do
|
45
|
+
@john.color = 'red'
|
46
|
+
assert @john.settings_changed?
|
47
|
+
end
|
48
|
+
|
49
|
+
test "updating the store populates the changed array correctly" do
|
50
|
+
@john.color = 'red'
|
51
|
+
assert_equal 'black', @john.settings_change[0]['color']
|
52
|
+
assert_equal 'red', @john.settings_change[1]['color']
|
53
|
+
end
|
54
|
+
|
55
|
+
test "updating the store won't mark it as changed if an attribute isn't changed" do
|
56
|
+
@john.color = @john.color
|
57
|
+
assert !@john.settings_changed?
|
58
|
+
end
|
59
|
+
|
60
|
+
test "object initialization with not nullable column" do
|
61
|
+
assert_equal true, @john.remember_login
|
62
|
+
end
|
63
|
+
|
64
|
+
test "writing with not nullable column" do
|
65
|
+
@john.remember_login = false
|
66
|
+
assert_equal false, @john.remember_login
|
67
|
+
end
|
68
|
+
|
69
|
+
test "overriding a write accessor" do
|
70
|
+
@john.phone_number = '(123) 456-7890'
|
71
|
+
|
72
|
+
assert_equal '1234567890', @john.settings[:phone_number]
|
73
|
+
end
|
74
|
+
|
75
|
+
test "overriding a write accessor using super" do
|
76
|
+
@john.color = 'yellow'
|
77
|
+
|
78
|
+
assert_equal 'blue', @john.color
|
79
|
+
end
|
80
|
+
|
81
|
+
test "preserve store attributes data in HashWithIndifferentAccess format without any conversion" do
|
82
|
+
@john.json_data = ActiveSupport::HashWithIndifferentAccess.new(:height => 'tall', 'weight' => 'heavy')
|
83
|
+
@john.height = 'low'
|
84
|
+
assert_equal true, @john.json_data.instance_of?(ActiveSupport::HashWithIndifferentAccess)
|
85
|
+
assert_equal 'low', @john.json_data[:height]
|
86
|
+
assert_equal 'low', @john.json_data['height']
|
87
|
+
assert_equal 'heavy', @john.json_data[:weight]
|
88
|
+
assert_equal 'heavy', @john.json_data['weight']
|
89
|
+
end
|
90
|
+
|
91
|
+
test "convert store attributes from Hash to HashWithIndifferentAccess saving the data and access attributes indifferently" do
|
92
|
+
user = Admin::User.find_by_name('Jamis')
|
93
|
+
assert_equal 'symbol', user.settings[:symbol]
|
94
|
+
assert_equal 'symbol', user.settings['symbol']
|
95
|
+
assert_equal 'string', user.settings[:string]
|
96
|
+
assert_equal 'string', user.settings['string']
|
97
|
+
assert_equal true, user.settings.instance_of?(ActiveSupport::HashWithIndifferentAccess)
|
98
|
+
|
99
|
+
user.height = 'low'
|
100
|
+
assert_equal 'symbol', user.settings[:symbol]
|
101
|
+
assert_equal 'symbol', user.settings['symbol']
|
102
|
+
assert_equal 'string', user.settings[:string]
|
103
|
+
assert_equal 'string', user.settings['string']
|
104
|
+
assert_equal true, user.settings.instance_of?(ActiveSupport::HashWithIndifferentAccess)
|
105
|
+
end
|
106
|
+
|
107
|
+
test "convert store attributes from any format other than Hash or HashWithIndifferent access losing the data" do
|
108
|
+
@john.json_data = "somedata"
|
109
|
+
@john.height = 'low'
|
110
|
+
assert_equal true, @john.json_data.instance_of?(ActiveSupport::HashWithIndifferentAccess)
|
111
|
+
assert_equal 'low', @john.json_data[:height]
|
112
|
+
assert_equal 'low', @john.json_data['height']
|
113
|
+
assert_equal false, @john.json_data.delete_if { |k, v| k == 'height' }.any?
|
114
|
+
end
|
115
|
+
|
116
|
+
test "reading store attributes through accessors encoded with JSON" do
|
117
|
+
assert_equal 'tall', @john.height
|
118
|
+
assert_nil @john.weight
|
119
|
+
end
|
120
|
+
|
121
|
+
test "writing store attributes through accessors encoded with JSON" do
|
122
|
+
@john.height = 'short'
|
123
|
+
@john.weight = 'heavy'
|
124
|
+
|
125
|
+
assert_equal 'short', @john.height
|
126
|
+
assert_equal 'heavy', @john.weight
|
127
|
+
end
|
128
|
+
|
129
|
+
test "accessing attributes not exposed by accessors encoded with JSON" do
|
130
|
+
@john.json_data['somestuff'] = 'somecoolstuff'
|
131
|
+
@john.save
|
132
|
+
|
133
|
+
assert_equal 'somecoolstuff', @john.reload.json_data['somestuff']
|
134
|
+
end
|
135
|
+
|
136
|
+
test "updating the store will mark it as changed encoded with JSON" do
|
137
|
+
@john.height = 'short'
|
138
|
+
assert @john.json_data_changed?
|
139
|
+
end
|
140
|
+
|
141
|
+
test "object initialization with not nullable column encoded with JSON" do
|
142
|
+
assert_equal true, @john.is_a_good_guy
|
143
|
+
end
|
144
|
+
|
145
|
+
test "writing with not nullable column encoded with JSON" do
|
146
|
+
@john.is_a_good_guy = false
|
147
|
+
assert_equal false, @john.is_a_good_guy
|
148
|
+
end
|
149
|
+
|
150
|
+
test "all stored attributes are returned" do
|
151
|
+
assert_equal [:color, :homepage, :favorite_food], Admin::User.stored_attributes[:settings]
|
152
|
+
end
|
153
|
+
end
|
@@ -0,0 +1,315 @@
|
|
1
|
+
require 'cases/helper'
|
2
|
+
|
3
|
+
module ActiveRecord
|
4
|
+
module DatabaseTasksSetupper
|
5
|
+
def setup
|
6
|
+
@mysql_tasks, @postgresql_tasks, @sqlite_tasks = stub, stub, stub
|
7
|
+
ActiveRecord::Tasks::MySQLDatabaseTasks.stubs(:new).returns @mysql_tasks
|
8
|
+
ActiveRecord::Tasks::PostgreSQLDatabaseTasks.stubs(:new).returns @postgresql_tasks
|
9
|
+
ActiveRecord::Tasks::SQLiteDatabaseTasks.stubs(:new).returns @sqlite_tasks
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
ADAPTERS_TASKS = {
|
14
|
+
mysql: :mysql_tasks,
|
15
|
+
mysql2: :mysql_tasks,
|
16
|
+
postgresql: :postgresql_tasks,
|
17
|
+
sqlite3: :sqlite_tasks
|
18
|
+
}
|
19
|
+
|
20
|
+
class DatabaseTasksRegisterTask < ActiveRecord::TestCase
|
21
|
+
def test_register_task
|
22
|
+
klazz = Class.new do
|
23
|
+
def initialize(*arguments); end
|
24
|
+
def structure_dump(filename); end
|
25
|
+
end
|
26
|
+
instance = klazz.new
|
27
|
+
|
28
|
+
klazz.stubs(:new).returns instance
|
29
|
+
instance.expects(:structure_dump).with("awesome-file.sql")
|
30
|
+
|
31
|
+
ActiveRecord::Tasks::DatabaseTasks.register_task(/foo/, klazz)
|
32
|
+
ActiveRecord::Tasks::DatabaseTasks.structure_dump({'adapter' => :foo}, "awesome-file.sql")
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_unregistered_task
|
36
|
+
assert_raise(ActiveRecord::Tasks::DatabaseNotSupported) do
|
37
|
+
ActiveRecord::Tasks::DatabaseTasks.structure_dump({'adapter' => :bar}, "awesome-file.sql")
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
class DatabaseTasksCreateTest < ActiveRecord::TestCase
|
43
|
+
include DatabaseTasksSetupper
|
44
|
+
|
45
|
+
ADAPTERS_TASKS.each do |k, v|
|
46
|
+
define_method("test_#{k}_create") do
|
47
|
+
eval("@#{v}").expects(:create)
|
48
|
+
ActiveRecord::Tasks::DatabaseTasks.create 'adapter' => k
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
class DatabaseTasksCreateAllTest < ActiveRecord::TestCase
|
54
|
+
def setup
|
55
|
+
@configurations = {'development' => {'database' => 'my-db'}}
|
56
|
+
|
57
|
+
ActiveRecord::Base.stubs(:configurations).returns(@configurations)
|
58
|
+
end
|
59
|
+
|
60
|
+
def test_ignores_configurations_without_databases
|
61
|
+
@configurations['development'].merge!('database' => nil)
|
62
|
+
|
63
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create).never
|
64
|
+
|
65
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_ignores_remote_databases
|
69
|
+
@configurations['development'].merge!('host' => 'my.server.tld')
|
70
|
+
$stderr.stubs(:puts).returns(nil)
|
71
|
+
|
72
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create).never
|
73
|
+
|
74
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_warning_for_remote_databases
|
78
|
+
@configurations['development'].merge!('host' => 'my.server.tld')
|
79
|
+
|
80
|
+
$stderr.expects(:puts).with('This task only modifies local databases. my-db is on a remote host.')
|
81
|
+
|
82
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_creates_configurations_with_local_ip
|
86
|
+
@configurations['development'].merge!('host' => '127.0.0.1')
|
87
|
+
|
88
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create)
|
89
|
+
|
90
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_creates_configurations_with_local_host
|
94
|
+
@configurations['development'].merge!('host' => 'localhost')
|
95
|
+
|
96
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create)
|
97
|
+
|
98
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
99
|
+
end
|
100
|
+
|
101
|
+
def test_creates_configurations_with_blank_hosts
|
102
|
+
@configurations['development'].merge!('host' => nil)
|
103
|
+
|
104
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create)
|
105
|
+
|
106
|
+
ActiveRecord::Tasks::DatabaseTasks.create_all
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
class DatabaseTasksCreateCurrentTest < ActiveRecord::TestCase
|
111
|
+
def setup
|
112
|
+
@configurations = {
|
113
|
+
'development' => {'database' => 'dev-db'},
|
114
|
+
'test' => {'database' => 'test-db'},
|
115
|
+
'production' => {'database' => 'prod-db'}
|
116
|
+
}
|
117
|
+
|
118
|
+
ActiveRecord::Base.stubs(:configurations).returns(@configurations)
|
119
|
+
ActiveRecord::Base.stubs(:establish_connection).returns(true)
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_creates_current_environment_database
|
123
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create).
|
124
|
+
with('database' => 'prod-db')
|
125
|
+
|
126
|
+
ActiveRecord::Tasks::DatabaseTasks.create_current(
|
127
|
+
ActiveSupport::StringInquirer.new('production')
|
128
|
+
)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_creates_test_database_when_environment_is_database
|
132
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create).
|
133
|
+
with('database' => 'dev-db')
|
134
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:create).
|
135
|
+
with('database' => 'test-db')
|
136
|
+
|
137
|
+
ActiveRecord::Tasks::DatabaseTasks.create_current(
|
138
|
+
ActiveSupport::StringInquirer.new('development')
|
139
|
+
)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_establishes_connection_for_the_given_environment
|
143
|
+
ActiveRecord::Tasks::DatabaseTasks.stubs(:create).returns true
|
144
|
+
|
145
|
+
ActiveRecord::Base.expects(:establish_connection).with('development')
|
146
|
+
|
147
|
+
ActiveRecord::Tasks::DatabaseTasks.create_current(
|
148
|
+
ActiveSupport::StringInquirer.new('development')
|
149
|
+
)
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
class DatabaseTasksDropTest < ActiveRecord::TestCase
|
154
|
+
include DatabaseTasksSetupper
|
155
|
+
|
156
|
+
ADAPTERS_TASKS.each do |k, v|
|
157
|
+
define_method("test_#{k}_drop") do
|
158
|
+
eval("@#{v}").expects(:drop)
|
159
|
+
ActiveRecord::Tasks::DatabaseTasks.drop 'adapter' => k
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class DatabaseTasksDropAllTest < ActiveRecord::TestCase
|
165
|
+
def setup
|
166
|
+
@configurations = {:development => {'database' => 'my-db'}}
|
167
|
+
|
168
|
+
ActiveRecord::Base.stubs(:configurations).returns(@configurations)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_ignores_configurations_without_databases
|
172
|
+
@configurations[:development].merge!('database' => nil)
|
173
|
+
|
174
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).never
|
175
|
+
|
176
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
177
|
+
end
|
178
|
+
|
179
|
+
def test_ignores_remote_databases
|
180
|
+
@configurations[:development].merge!('host' => 'my.server.tld')
|
181
|
+
$stderr.stubs(:puts).returns(nil)
|
182
|
+
|
183
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).never
|
184
|
+
|
185
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
186
|
+
end
|
187
|
+
|
188
|
+
def test_warning_for_remote_databases
|
189
|
+
@configurations[:development].merge!('host' => 'my.server.tld')
|
190
|
+
|
191
|
+
$stderr.expects(:puts).with('This task only modifies local databases. my-db is on a remote host.')
|
192
|
+
|
193
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_creates_configurations_with_local_ip
|
197
|
+
@configurations[:development].merge!('host' => '127.0.0.1')
|
198
|
+
|
199
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop)
|
200
|
+
|
201
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
202
|
+
end
|
203
|
+
|
204
|
+
def test_creates_configurations_with_local_host
|
205
|
+
@configurations[:development].merge!('host' => 'localhost')
|
206
|
+
|
207
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop)
|
208
|
+
|
209
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_creates_configurations_with_blank_hosts
|
213
|
+
@configurations[:development].merge!('host' => nil)
|
214
|
+
|
215
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop)
|
216
|
+
|
217
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_all
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
class DatabaseTasksDropCurrentTest < ActiveRecord::TestCase
|
222
|
+
def setup
|
223
|
+
@configurations = {
|
224
|
+
'development' => {'database' => 'dev-db'},
|
225
|
+
'test' => {'database' => 'test-db'},
|
226
|
+
'production' => {'database' => 'prod-db'}
|
227
|
+
}
|
228
|
+
|
229
|
+
ActiveRecord::Base.stubs(:configurations).returns(@configurations)
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_creates_current_environment_database
|
233
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).
|
234
|
+
with('database' => 'prod-db')
|
235
|
+
|
236
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_current(
|
237
|
+
ActiveSupport::StringInquirer.new('production')
|
238
|
+
)
|
239
|
+
end
|
240
|
+
|
241
|
+
def test_creates_test_database_when_environment_is_database
|
242
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).
|
243
|
+
with('database' => 'dev-db')
|
244
|
+
ActiveRecord::Tasks::DatabaseTasks.expects(:drop).
|
245
|
+
with('database' => 'test-db')
|
246
|
+
|
247
|
+
ActiveRecord::Tasks::DatabaseTasks.drop_current(
|
248
|
+
ActiveSupport::StringInquirer.new('development')
|
249
|
+
)
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
class DatabaseTasksPurgeTest < ActiveRecord::TestCase
|
255
|
+
include DatabaseTasksSetupper
|
256
|
+
|
257
|
+
ADAPTERS_TASKS.each do |k, v|
|
258
|
+
define_method("test_#{k}_purge") do
|
259
|
+
eval("@#{v}").expects(:purge)
|
260
|
+
ActiveRecord::Tasks::DatabaseTasks.purge 'adapter' => k
|
261
|
+
end
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
class DatabaseTasksCharsetTest < ActiveRecord::TestCase
|
266
|
+
include DatabaseTasksSetupper
|
267
|
+
|
268
|
+
ADAPTERS_TASKS.each do |k, v|
|
269
|
+
define_method("test_#{k}_charset") do
|
270
|
+
eval("@#{v}").expects(:charset)
|
271
|
+
ActiveRecord::Tasks::DatabaseTasks.charset 'adapter' => k
|
272
|
+
end
|
273
|
+
end
|
274
|
+
end
|
275
|
+
|
276
|
+
class DatabaseTasksCollationTest < ActiveRecord::TestCase
|
277
|
+
include DatabaseTasksSetupper
|
278
|
+
|
279
|
+
ADAPTERS_TASKS.each do |k, v|
|
280
|
+
define_method("test_#{k}_collation") do
|
281
|
+
eval("@#{v}").expects(:collation)
|
282
|
+
ActiveRecord::Tasks::DatabaseTasks.collation 'adapter' => k
|
283
|
+
end
|
284
|
+
end
|
285
|
+
end
|
286
|
+
|
287
|
+
class DatabaseTasksStructureDumpTest < ActiveRecord::TestCase
|
288
|
+
include DatabaseTasksSetupper
|
289
|
+
|
290
|
+
ADAPTERS_TASKS.each do |k, v|
|
291
|
+
define_method("test_#{k}_structure_dump") do
|
292
|
+
eval("@#{v}").expects(:structure_dump).with("awesome-file.sql")
|
293
|
+
ActiveRecord::Tasks::DatabaseTasks.structure_dump({'adapter' => k}, "awesome-file.sql")
|
294
|
+
end
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
class DatabaseTasksStructureLoadTest < ActiveRecord::TestCase
|
299
|
+
include DatabaseTasksSetupper
|
300
|
+
|
301
|
+
ADAPTERS_TASKS.each do |k, v|
|
302
|
+
define_method("test_#{k}_structure_load") do
|
303
|
+
eval("@#{v}").expects(:structure_load).with("awesome-file.sql")
|
304
|
+
ActiveRecord::Tasks::DatabaseTasks.structure_load({'adapter' => k}, "awesome-file.sql")
|
305
|
+
end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
class DatabaseTasksCheckSchemaFileTest < ActiveRecord::TestCase
|
310
|
+
def test_check_schema_file
|
311
|
+
Kernel.expects(:abort).with(regexp_matches(/awesome-file.sql/))
|
312
|
+
ActiveRecord::Tasks::DatabaseTasks.check_schema_file("awesome-file.sql")
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|