nbudin-castronaut 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.textile +67 -0
- data/Rakefile +73 -0
- data/app/config.rb +17 -0
- data/app/config.ru +24 -0
- data/app/controllers/application.rb +42 -0
- data/app/public/javascripts/application.js +3 -0
- data/app/public/javascripts/jquery.js +32 -0
- data/app/public/stylesheets/screen.css +122 -0
- data/app/views/layout.erb +27 -0
- data/app/views/login.erb +31 -0
- data/app/views/logout.erb +13 -0
- data/app/views/proxy_validate.erb +22 -0
- data/app/views/service_validate.erb +15 -0
- data/bin/castronaut +71 -0
- data/castronaut.rb +7 -0
- data/config/castronaut.example.yml +41 -0
- data/config/castronaut.sample.yml +40 -0
- data/config/nginx_vhost.conf +17 -0
- data/config/thin_config.yml +13 -0
- data/lib/castronaut.rb +35 -0
- data/lib/castronaut/adapters.rb +22 -0
- data/lib/castronaut/adapters/development/adapter.rb +13 -0
- data/lib/castronaut/adapters/development/user.rb +25 -0
- data/lib/castronaut/adapters/ldap/adapter.rb +15 -0
- data/lib/castronaut/adapters/ldap/user.rb +39 -0
- data/lib/castronaut/adapters/restful_authentication/adapter.rb +15 -0
- data/lib/castronaut/adapters/restful_authentication/user.rb +50 -0
- data/lib/castronaut/authentication_result.rb +24 -0
- data/lib/castronaut/configuration.rb +108 -0
- data/lib/castronaut/db/001_create_cas_database.rb +47 -0
- data/lib/castronaut/extra_attributes.rb +8 -0
- data/lib/castronaut/models/consumeable.rb +18 -0
- data/lib/castronaut/models/dispenser.rb +14 -0
- data/lib/castronaut/models/login_ticket.rb +53 -0
- data/lib/castronaut/models/proxy_granting_ticket.rb +70 -0
- data/lib/castronaut/models/proxy_ticket.rb +43 -0
- data/lib/castronaut/models/service_ticket.rb +91 -0
- data/lib/castronaut/models/ticket_granting_ticket.rb +52 -0
- data/lib/castronaut/presenters/login.rb +84 -0
- data/lib/castronaut/presenters/logout.rb +56 -0
- data/lib/castronaut/presenters/process_login.rb +149 -0
- data/lib/castronaut/presenters/proxy_validate.rb +68 -0
- data/lib/castronaut/presenters/service_validate.rb +69 -0
- data/lib/castronaut/support/sample.rb +21 -0
- data/lib/castronaut/ticket_result.rb +27 -0
- data/lib/castronaut/utilities/random_string.rb +24 -0
- data/spec/app/controllers/application_spec.rb +86 -0
- data/spec/castronaut/adapters/development/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/development/user_spec.rb +55 -0
- data/spec/castronaut/adapters/ldap/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/ldap/user_spec.rb +25 -0
- data/spec/castronaut/adapters/restful_authentication/adapter_spec.rb +14 -0
- data/spec/castronaut/adapters/restful_authentication/user_spec.rb +108 -0
- data/spec/castronaut/adapters_spec.rb +13 -0
- data/spec/castronaut/authentication_result_spec.rb +20 -0
- data/spec/castronaut/configuration_spec.rb +172 -0
- data/spec/castronaut/models/consumeable_spec.rb +39 -0
- data/spec/castronaut/models/dispenser_spec.rb +30 -0
- data/spec/castronaut/models/login_ticket_spec.rb +107 -0
- data/spec/castronaut/models/proxy_granting_ticket_spec.rb +302 -0
- data/spec/castronaut/models/proxy_ticket_spec.rb +109 -0
- data/spec/castronaut/models/service_ticket_spec.rb +269 -0
- data/spec/castronaut/models/ticket_granting_ticket_spec.rb +89 -0
- data/spec/castronaut/presenters/login_spec.rb +152 -0
- data/spec/castronaut/presenters/logout_spec.rb +85 -0
- data/spec/castronaut/presenters/process_login_spec.rb +300 -0
- data/spec/castronaut/presenters/proxy_validate_spec.rb +103 -0
- data/spec/castronaut/presenters/service_validate_spec.rb +86 -0
- data/spec/castronaut/ticket_result_spec.rb +42 -0
- data/spec/castronaut/utilities/random_string_spec.rb +14 -0
- data/spec/castronaut_spec.rb +26 -0
- data/spec/spec_controller_helper.rb +17 -0
- data/spec/spec_helper.rb +39 -0
- data/spec/spec_rails_mocks.rb +132 -0
- data/vendor/activerecord/CHANGELOG +5786 -0
- data/vendor/activerecord/README +351 -0
- data/vendor/activerecord/RUNNING_UNIT_TESTS +36 -0
- data/vendor/activerecord/Rakefile +247 -0
- data/vendor/activerecord/examples/associations.png +0 -0
- data/vendor/activerecord/install.rb +30 -0
- data/vendor/activerecord/lib/active_record.rb +81 -0
- data/vendor/activerecord/lib/active_record/aggregations.rb +261 -0
- data/vendor/activerecord/lib/active_record/association_preload.rb +374 -0
- data/vendor/activerecord/lib/active_record/associations.rb +2227 -0
- data/vendor/activerecord/lib/active_record/associations/association_collection.rb +453 -0
- data/vendor/activerecord/lib/active_record/associations/association_proxy.rb +272 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_association.rb +58 -0
- data/vendor/activerecord/lib/active_record/associations/belongs_to_polymorphic_association.rb +49 -0
- data/vendor/activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_association.rb +121 -0
- data/vendor/activerecord/lib/active_record/associations/has_many_through_association.rb +256 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_association.rb +115 -0
- data/vendor/activerecord/lib/active_record/associations/has_one_through_association.rb +31 -0
- data/vendor/activerecord/lib/active_record/attribute_methods.rb +387 -0
- data/vendor/activerecord/lib/active_record/base.rb +2967 -0
- data/vendor/activerecord/lib/active_record/calculations.rb +299 -0
- data/vendor/activerecord/lib/active_record/callbacks.rb +331 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb +355 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb +136 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb +201 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb +94 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rb +705 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb +434 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb +210 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb +585 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb +1065 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
- data/vendor/activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb +418 -0
- data/vendor/activerecord/lib/active_record/dirty.rb +183 -0
- data/vendor/activerecord/lib/active_record/dynamic_finder_match.rb +41 -0
- data/vendor/activerecord/lib/active_record/fixtures.rb +998 -0
- data/vendor/activerecord/lib/active_record/i18n_interpolation_deprecation.rb +26 -0
- data/vendor/activerecord/lib/active_record/locale/en.yml +54 -0
- data/vendor/activerecord/lib/active_record/locking/optimistic.rb +148 -0
- data/vendor/activerecord/lib/active_record/locking/pessimistic.rb +77 -0
- data/vendor/activerecord/lib/active_record/migration.rb +560 -0
- data/vendor/activerecord/lib/active_record/named_scope.rb +181 -0
- data/vendor/activerecord/lib/active_record/observer.rb +197 -0
- data/vendor/activerecord/lib/active_record/query_cache.rb +21 -0
- data/vendor/activerecord/lib/active_record/reflection.rb +307 -0
- data/vendor/activerecord/lib/active_record/schema.rb +51 -0
- data/vendor/activerecord/lib/active_record/schema_dumper.rb +177 -0
- data/vendor/activerecord/lib/active_record/serialization.rb +98 -0
- data/vendor/activerecord/lib/active_record/serializers/json_serializer.rb +80 -0
- data/vendor/activerecord/lib/active_record/serializers/xml_serializer.rb +338 -0
- data/vendor/activerecord/lib/active_record/test_case.rb +60 -0
- data/vendor/activerecord/lib/active_record/timestamp.rb +41 -0
- data/vendor/activerecord/lib/active_record/transactions.rb +185 -0
- data/vendor/activerecord/lib/active_record/validations.rb +1061 -0
- data/vendor/activerecord/lib/active_record/version.rb +9 -0
- data/vendor/activerecord/lib/activerecord.rb +1 -0
- data/vendor/activerecord/test/assets/example.log +1 -0
- data/vendor/activerecord/test/assets/flowers.jpg +0 -0
- data/vendor/activerecord/test/cases/aaa_create_tables_test.rb +24 -0
- data/vendor/activerecord/test/cases/active_schema_test_mysql.rb +100 -0
- data/vendor/activerecord/test/cases/active_schema_test_postgresql.rb +24 -0
- data/vendor/activerecord/test/cases/adapter_test.rb +133 -0
- data/vendor/activerecord/test/cases/aggregations_test.rb +167 -0
- data/vendor/activerecord/test/cases/ar_schema_test.rb +33 -0
- data/vendor/activerecord/test/cases/associations/belongs_to_associations_test.rb +441 -0
- data/vendor/activerecord/test/cases/associations/callbacks_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/cascaded_eager_loading_test.rb +123 -0
- data/vendor/activerecord/test/cases/associations/eager_load_includes_full_sti_class_test.rb +36 -0
- data/vendor/activerecord/test/cases/associations/eager_load_nested_include_test.rb +101 -0
- data/vendor/activerecord/test/cases/associations/eager_singularization_test.rb +145 -0
- data/vendor/activerecord/test/cases/associations/eager_test.rb +692 -0
- data/vendor/activerecord/test/cases/associations/extension_test.rb +62 -0
- data/vendor/activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb +773 -0
- data/vendor/activerecord/test/cases/associations/has_many_associations_test.rb +1101 -0
- data/vendor/activerecord/test/cases/associations/has_many_through_associations_test.rb +247 -0
- data/vendor/activerecord/test/cases/associations/has_one_associations_test.rb +362 -0
- data/vendor/activerecord/test/cases/associations/has_one_through_associations_test.rb +161 -0
- data/vendor/activerecord/test/cases/associations/inner_join_association_test.rb +88 -0
- data/vendor/activerecord/test/cases/associations/join_model_test.rb +714 -0
- data/vendor/activerecord/test/cases/associations_test.rb +262 -0
- data/vendor/activerecord/test/cases/attribute_methods_test.rb +293 -0
- data/vendor/activerecord/test/cases/base_test.rb +2087 -0
- data/vendor/activerecord/test/cases/binary_test.rb +30 -0
- data/vendor/activerecord/test/cases/calculations_test.rb +328 -0
- data/vendor/activerecord/test/cases/callbacks_observers_test.rb +38 -0
- data/vendor/activerecord/test/cases/callbacks_test.rb +400 -0
- data/vendor/activerecord/test/cases/class_inheritable_attributes_test.rb +32 -0
- data/vendor/activerecord/test/cases/column_alias_test.rb +17 -0
- data/vendor/activerecord/test/cases/column_definition_test.rb +36 -0
- data/vendor/activerecord/test/cases/connection_test_firebird.rb +8 -0
- data/vendor/activerecord/test/cases/connection_test_mysql.rb +30 -0
- data/vendor/activerecord/test/cases/copy_table_test_sqlite.rb +69 -0
- data/vendor/activerecord/test/cases/database_statements_test.rb +12 -0
- data/vendor/activerecord/test/cases/datatype_test_postgresql.rb +203 -0
- data/vendor/activerecord/test/cases/date_time_test.rb +37 -0
- data/vendor/activerecord/test/cases/default_test_firebird.rb +16 -0
- data/vendor/activerecord/test/cases/defaults_test.rb +100 -0
- data/vendor/activerecord/test/cases/deprecated_finder_test.rb +30 -0
- data/vendor/activerecord/test/cases/dirty_test.rb +270 -0
- data/vendor/activerecord/test/cases/finder_respond_to_test.rb +76 -0
- data/vendor/activerecord/test/cases/finder_test.rb +1048 -0
- data/vendor/activerecord/test/cases/fixtures_test.rb +655 -0
- data/vendor/activerecord/test/cases/helper.rb +62 -0
- data/vendor/activerecord/test/cases/i18n_test.rb +41 -0
- data/vendor/activerecord/test/cases/inheritance_test.rb +262 -0
- data/vendor/activerecord/test/cases/invalid_date_test.rb +24 -0
- data/vendor/activerecord/test/cases/json_serialization_test.rb +205 -0
- data/vendor/activerecord/test/cases/lifecycle_test.rb +193 -0
- data/vendor/activerecord/test/cases/locking_test.rb +304 -0
- data/vendor/activerecord/test/cases/method_scoping_test.rb +569 -0
- data/vendor/activerecord/test/cases/migration_test.rb +1479 -0
- data/vendor/activerecord/test/cases/migration_test_firebird.rb +124 -0
- data/vendor/activerecord/test/cases/mixin_test.rb +96 -0
- data/vendor/activerecord/test/cases/modules_test.rb +39 -0
- data/vendor/activerecord/test/cases/multiple_db_test.rb +85 -0
- data/vendor/activerecord/test/cases/named_scope_test.rb +280 -0
- data/vendor/activerecord/test/cases/pk_test.rb +101 -0
- data/vendor/activerecord/test/cases/pooled_connections_test.rb +103 -0
- data/vendor/activerecord/test/cases/query_cache_test.rb +127 -0
- data/vendor/activerecord/test/cases/readonly_test.rb +107 -0
- data/vendor/activerecord/test/cases/reflection_test.rb +184 -0
- data/vendor/activerecord/test/cases/reload_models_test.rb +20 -0
- data/vendor/activerecord/test/cases/reserved_word_test_mysql.rb +176 -0
- data/vendor/activerecord/test/cases/sanitize_test.rb +25 -0
- data/vendor/activerecord/test/cases/schema_authorization_test_postgresql.rb +75 -0
- data/vendor/activerecord/test/cases/schema_dumper_test.rb +184 -0
- data/vendor/activerecord/test/cases/schema_test_postgresql.rb +102 -0
- data/vendor/activerecord/test/cases/serialization_test.rb +47 -0
- data/vendor/activerecord/test/cases/synonym_test_oracle.rb +17 -0
- data/vendor/activerecord/test/cases/transactions_test.rb +357 -0
- data/vendor/activerecord/test/cases/unconnected_test.rb +32 -0
- data/vendor/activerecord/test/cases/validations_i18n_test.rb +921 -0
- data/vendor/activerecord/test/cases/validations_test.rb +1552 -0
- data/vendor/activerecord/test/cases/xml_serialization_test.rb +202 -0
- data/vendor/activerecord/test/config.rb +5 -0
- data/vendor/activerecord/test/connections/native_db2/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_firebird/connection.rb +26 -0
- data/vendor/activerecord/test/connections/native_frontbase/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_mysql/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_openbase/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_oracle/connection.rb +27 -0
- data/vendor/activerecord/test/connections/native_postgresql/connection.rb +21 -0
- data/vendor/activerecord/test/connections/native_sqlite/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/connection.rb +25 -0
- data/vendor/activerecord/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
- data/vendor/activerecord/test/connections/native_sybase/connection.rb +23 -0
- data/vendor/activerecord/test/fixtures/accounts.yml +28 -0
- data/vendor/activerecord/test/fixtures/all/developers.yml +0 -0
- data/vendor/activerecord/test/fixtures/all/people.csv +0 -0
- data/vendor/activerecord/test/fixtures/all/tasks.yml +0 -0
- data/vendor/activerecord/test/fixtures/author_addresses.yml +5 -0
- data/vendor/activerecord/test/fixtures/author_favorites.yml +4 -0
- data/vendor/activerecord/test/fixtures/authors.yml +9 -0
- data/vendor/activerecord/test/fixtures/binaries.yml +132 -0
- data/vendor/activerecord/test/fixtures/books.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories.yml +14 -0
- data/vendor/activerecord/test/fixtures/categories/special_categories.yml +9 -0
- data/vendor/activerecord/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
- data/vendor/activerecord/test/fixtures/categories_ordered.yml +7 -0
- data/vendor/activerecord/test/fixtures/categories_posts.yml +23 -0
- data/vendor/activerecord/test/fixtures/categorizations.yml +17 -0
- data/vendor/activerecord/test/fixtures/clubs.yml +6 -0
- data/vendor/activerecord/test/fixtures/comments.yml +59 -0
- data/vendor/activerecord/test/fixtures/companies.yml +56 -0
- data/vendor/activerecord/test/fixtures/computers.yml +4 -0
- data/vendor/activerecord/test/fixtures/courses.yml +7 -0
- data/vendor/activerecord/test/fixtures/customers.yml +26 -0
- data/vendor/activerecord/test/fixtures/developers.yml +21 -0
- data/vendor/activerecord/test/fixtures/developers_projects.yml +17 -0
- data/vendor/activerecord/test/fixtures/edges.yml +6 -0
- data/vendor/activerecord/test/fixtures/entrants.yml +14 -0
- data/vendor/activerecord/test/fixtures/fixture_database.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fixture_database_2.sqlite3 +0 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_fk.yml +3 -0
- data/vendor/activerecord/test/fixtures/fk_test_has_pk.yml +2 -0
- data/vendor/activerecord/test/fixtures/funny_jokes.yml +10 -0
- data/vendor/activerecord/test/fixtures/items.yml +4 -0
- data/vendor/activerecord/test/fixtures/jobs.yml +7 -0
- data/vendor/activerecord/test/fixtures/legacy_things.yml +3 -0
- data/vendor/activerecord/test/fixtures/mateys.yml +4 -0
- data/vendor/activerecord/test/fixtures/members.yml +4 -0
- data/vendor/activerecord/test/fixtures/memberships.yml +20 -0
- data/vendor/activerecord/test/fixtures/minimalistics.yml +2 -0
- data/vendor/activerecord/test/fixtures/mixed_case_monkeys.yml +6 -0
- data/vendor/activerecord/test/fixtures/mixins.yml +29 -0
- data/vendor/activerecord/test/fixtures/movies.yml +7 -0
- data/vendor/activerecord/test/fixtures/naked/csv/accounts.csv +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/accounts.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/companies.yml +1 -0
- data/vendor/activerecord/test/fixtures/naked/yml/courses.yml +1 -0
- data/vendor/activerecord/test/fixtures/organizations.yml +5 -0
- data/vendor/activerecord/test/fixtures/owners.yml +7 -0
- data/vendor/activerecord/test/fixtures/parrots.yml +27 -0
- data/vendor/activerecord/test/fixtures/parrots_pirates.yml +7 -0
- data/vendor/activerecord/test/fixtures/people.yml +6 -0
- data/vendor/activerecord/test/fixtures/pets.yml +14 -0
- data/vendor/activerecord/test/fixtures/pirates.yml +9 -0
- data/vendor/activerecord/test/fixtures/posts.yml +49 -0
- data/vendor/activerecord/test/fixtures/price_estimates.yml +7 -0
- data/vendor/activerecord/test/fixtures/projects.yml +7 -0
- data/vendor/activerecord/test/fixtures/readers.yml +9 -0
- data/vendor/activerecord/test/fixtures/references.yml +17 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distinct.yml +5 -0
- data/vendor/activerecord/test/fixtures/reserved_words/distincts_selects.yml +11 -0
- data/vendor/activerecord/test/fixtures/reserved_words/group.yml +14 -0
- data/vendor/activerecord/test/fixtures/reserved_words/select.yml +8 -0
- data/vendor/activerecord/test/fixtures/reserved_words/values.yml +7 -0
- data/vendor/activerecord/test/fixtures/ships.yml +5 -0
- data/vendor/activerecord/test/fixtures/sponsors.yml +9 -0
- data/vendor/activerecord/test/fixtures/subscribers.yml +7 -0
- data/vendor/activerecord/test/fixtures/subscriptions.yml +12 -0
- data/vendor/activerecord/test/fixtures/taggings.yml +28 -0
- data/vendor/activerecord/test/fixtures/tags.yml +7 -0
- data/vendor/activerecord/test/fixtures/tasks.yml +7 -0
- data/vendor/activerecord/test/fixtures/topics.yml +42 -0
- data/vendor/activerecord/test/fixtures/treasures.yml +10 -0
- data/vendor/activerecord/test/fixtures/vertices.yml +4 -0
- data/vendor/activerecord/test/fixtures/warehouse-things.yml +3 -0
- data/vendor/activerecord/test/migrations/broken/100_migration_that_raises_exception.rb +10 -0
- data/vendor/activerecord/test/migrations/decimal/1_give_me_big_numbers.rb +15 -0
- data/vendor/activerecord/test/migrations/duplicate/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/duplicate/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate/3_foo.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507052938_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/duplicate_names/20080507053028_chunky.rb +7 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_1/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_2/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb +8 -0
- data/vendor/activerecord/test/migrations/interleaved/pass_3/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/1000_people_have_middle_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/missing/3_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/missing/4_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/1_people_have_last_names.rb +9 -0
- data/vendor/activerecord/test/migrations/valid/2_we_need_reminders.rb +12 -0
- data/vendor/activerecord/test/migrations/valid/3_innocent_jointable.rb +12 -0
- data/vendor/activerecord/test/models/author.rb +140 -0
- data/vendor/activerecord/test/models/auto_id.rb +4 -0
- data/vendor/activerecord/test/models/binary.rb +2 -0
- data/vendor/activerecord/test/models/book.rb +4 -0
- data/vendor/activerecord/test/models/categorization.rb +5 -0
- data/vendor/activerecord/test/models/category.rb +33 -0
- data/vendor/activerecord/test/models/citation.rb +6 -0
- data/vendor/activerecord/test/models/club.rb +13 -0
- data/vendor/activerecord/test/models/column_name.rb +3 -0
- data/vendor/activerecord/test/models/comment.rb +25 -0
- data/vendor/activerecord/test/models/company.rb +156 -0
- data/vendor/activerecord/test/models/company_in_module.rb +61 -0
- data/vendor/activerecord/test/models/computer.rb +3 -0
- data/vendor/activerecord/test/models/contact.rb +16 -0
- data/vendor/activerecord/test/models/course.rb +3 -0
- data/vendor/activerecord/test/models/customer.rb +73 -0
- data/vendor/activerecord/test/models/default.rb +2 -0
- data/vendor/activerecord/test/models/developer.rb +79 -0
- data/vendor/activerecord/test/models/edge.rb +5 -0
- data/vendor/activerecord/test/models/entrant.rb +3 -0
- data/vendor/activerecord/test/models/guid.rb +2 -0
- data/vendor/activerecord/test/models/item.rb +7 -0
- data/vendor/activerecord/test/models/job.rb +5 -0
- data/vendor/activerecord/test/models/joke.rb +3 -0
- data/vendor/activerecord/test/models/keyboard.rb +3 -0
- data/vendor/activerecord/test/models/legacy_thing.rb +3 -0
- data/vendor/activerecord/test/models/matey.rb +4 -0
- data/vendor/activerecord/test/models/member.rb +11 -0
- data/vendor/activerecord/test/models/member_detail.rb +4 -0
- data/vendor/activerecord/test/models/membership.rb +9 -0
- data/vendor/activerecord/test/models/minimalistic.rb +2 -0
- data/vendor/activerecord/test/models/mixed_case_monkey.rb +3 -0
- data/vendor/activerecord/test/models/movie.rb +5 -0
- data/vendor/activerecord/test/models/order.rb +4 -0
- data/vendor/activerecord/test/models/organization.rb +4 -0
- data/vendor/activerecord/test/models/owner.rb +4 -0
- data/vendor/activerecord/test/models/parrot.rb +14 -0
- data/vendor/activerecord/test/models/person.rb +10 -0
- data/vendor/activerecord/test/models/pet.rb +4 -0
- data/vendor/activerecord/test/models/pirate.rb +9 -0
- data/vendor/activerecord/test/models/post.rb +88 -0
- data/vendor/activerecord/test/models/price_estimate.rb +3 -0
- data/vendor/activerecord/test/models/project.rb +29 -0
- data/vendor/activerecord/test/models/reader.rb +4 -0
- data/vendor/activerecord/test/models/reference.rb +4 -0
- data/vendor/activerecord/test/models/reply.rb +39 -0
- data/vendor/activerecord/test/models/ship.rb +3 -0
- data/vendor/activerecord/test/models/sponsor.rb +4 -0
- data/vendor/activerecord/test/models/subject.rb +4 -0
- data/vendor/activerecord/test/models/subscriber.rb +8 -0
- data/vendor/activerecord/test/models/subscription.rb +4 -0
- data/vendor/activerecord/test/models/tag.rb +7 -0
- data/vendor/activerecord/test/models/tagging.rb +10 -0
- data/vendor/activerecord/test/models/task.rb +3 -0
- data/vendor/activerecord/test/models/topic.rb +69 -0
- data/vendor/activerecord/test/models/treasure.rb +6 -0
- data/vendor/activerecord/test/models/vertex.rb +9 -0
- data/vendor/activerecord/test/models/warehouse_thing.rb +5 -0
- data/vendor/activerecord/test/schema/mysql_specific_schema.rb +12 -0
- data/vendor/activerecord/test/schema/postgresql_specific_schema.rb +103 -0
- data/vendor/activerecord/test/schema/schema.rb +440 -0
- data/vendor/activerecord/test/schema/schema2.rb +6 -0
- data/vendor/activerecord/test/schema/sqlite_specific_schema.rb +25 -0
- data/vendor/activesupport/CHANGELOG +1257 -0
- data/vendor/activesupport/README +43 -0
- data/vendor/activesupport/lib/active_support.rb +61 -0
- data/vendor/activesupport/lib/active_support/base64.rb +33 -0
- data/vendor/activesupport/lib/active_support/basic_object.rb +24 -0
- data/vendor/activesupport/lib/active_support/buffered_logger.rb +122 -0
- data/vendor/activesupport/lib/active_support/cache.rb +223 -0
- data/vendor/activesupport/lib/active_support/cache/compressed_mem_cache_store.rb +20 -0
- data/vendor/activesupport/lib/active_support/cache/drb_store.rb +15 -0
- data/vendor/activesupport/lib/active_support/cache/file_store.rb +72 -0
- data/vendor/activesupport/lib/active_support/cache/mem_cache_store.rb +127 -0
- data/vendor/activesupport/lib/active_support/cache/memory_store.rb +52 -0
- data/vendor/activesupport/lib/active_support/cache/synchronized_memory_store.rb +47 -0
- data/vendor/activesupport/lib/active_support/callbacks.rb +280 -0
- data/vendor/activesupport/lib/active_support/core_ext.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/array.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/access.rb +53 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/conversions.rb +183 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/extract_options.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/grouping.rb +106 -0
- data/vendor/activesupport/lib/active_support/core_ext/array/random_access.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/base64/encoding.rb +16 -0
- data/vendor/activesupport/lib/active_support/core_ext/benchmark.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal.rb +6 -0
- data/vendor/activesupport/lib/active_support/core_ext/bigdecimal/conversions.rb +37 -0
- data/vendor/activesupport/lib/active_support/core_ext/blank.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/cgi/escape_skipping_slashes.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/class.rb +4 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/attribute_accessors.rb +54 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/delegating_attributes.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb +140 -0
- data/vendor/activesupport/lib/active_support/core_ext/class/removal.rb +50 -0
- data/vendor/activesupport/lib/active_support/core_ext/date.rb +10 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/behavior.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/calculations.rb +230 -0
- data/vendor/activesupport/lib/active_support/core_ext/date/conversions.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/calculations.rb +126 -0
- data/vendor/activesupport/lib/active_support/core_ext/date_time/conversions.rb +96 -0
- data/vendor/activesupport/lib/active_support/core_ext/duplicable.rb +43 -0
- data/vendor/activesupport/lib/active_support/core_ext/enumerable.rb +107 -0
- data/vendor/activesupport/lib/active_support/core_ext/exception.rb +41 -0
- data/vendor/activesupport/lib/active_support/core_ext/file.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/file/atomic.rb +46 -0
- data/vendor/activesupport/lib/active_support/core_ext/float.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/rounding.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/float/time.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/conversions.rb +259 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/diff.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/except.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/indifferent_access.rb +137 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/keys.rb +52 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/reverse_merge.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/hash/slice.rb +33 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/even_odd.rb +29 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/inflections.rb +20 -0
- data/vendor/activesupport/lib/active_support/core_ext/integer/time.rb +45 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/agnostics.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/daemonizing.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/debugger.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/reporting.rb +59 -0
- data/vendor/activesupport/lib/active_support/core_ext/kernel/requires.rb +24 -0
- data/vendor/activesupport/lib/active_support/core_ext/load_error.rb +38 -0
- data/vendor/activesupport/lib/active_support/core_ext/logger.rb +143 -0
- data/vendor/activesupport/lib/active_support/core_ext/module.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/aliasing.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_accessor_with_default.rb +31 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attr_internal.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/attribute_accessors.rb +58 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/delegation.rb +95 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/inclusion.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/introspection.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/loading.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/model_naming.rb +23 -0
- data/vendor/activesupport/lib/active_support/core_ext/module/synchronization.rb +39 -0
- data/vendor/activesupport/lib/active_support/core_ext/name_error.rb +17 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric.rb +9 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/bytes.rb +44 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/conversions.rb +19 -0
- data/vendor/activesupport/lib/active_support/core_ext/numeric/time.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/object.rb +5 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/conversions.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/extending.rb +80 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/instance_variables.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/metaclass.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/object/misc.rb +74 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname.rb +7 -0
- data/vendor/activesupport/lib/active_support/core_ext/pathname/clean_within.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/proc.rb +12 -0
- data/vendor/activesupport/lib/active_support/core_ext/process.rb +1 -0
- data/vendor/activesupport/lib/active_support/core_ext/process/daemon.rb +25 -0
- data/vendor/activesupport/lib/active_support/core_ext/range.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/blockless_step.rb +32 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/conversions.rb +27 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/include_range.rb +30 -0
- data/vendor/activesupport/lib/active_support/core_ext/range/overlaps.rb +15 -0
- data/vendor/activesupport/lib/active_support/core_ext/rexml.rb +36 -0
- data/vendor/activesupport/lib/active_support/core_ext/string.rb +22 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/access.rb +82 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/conversions.rb +28 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/filters.rb +26 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/inflections.rb +167 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/iterators.rb +21 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/multibyte.rb +81 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/starts_ends_with.rb +35 -0
- data/vendor/activesupport/lib/active_support/core_ext/string/xchar.rb +11 -0
- data/vendor/activesupport/lib/active_support/core_ext/symbol.rb +14 -0
- data/vendor/activesupport/lib/active_support/core_ext/time.rb +42 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/behavior.rb +13 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/calculations.rb +303 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/conversions.rb +90 -0
- data/vendor/activesupport/lib/active_support/core_ext/time/zones.rb +86 -0
- data/vendor/activesupport/lib/active_support/dependencies.rb +621 -0
- data/vendor/activesupport/lib/active_support/deprecation.rb +243 -0
- data/vendor/activesupport/lib/active_support/duration.rb +96 -0
- data/vendor/activesupport/lib/active_support/gzip.rb +25 -0
- data/vendor/activesupport/lib/active_support/inflections.rb +55 -0
- data/vendor/activesupport/lib/active_support/inflector.rb +397 -0
- data/vendor/activesupport/lib/active_support/json.rb +23 -0
- data/vendor/activesupport/lib/active_support/json/decoding.rb +63 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/date_time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/enumerable.rb +12 -0
- data/vendor/activesupport/lib/active_support/json/encoders/false_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/hash.rb +47 -0
- data/vendor/activesupport/lib/active_support/json/encoders/nil_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/numeric.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/object.rb +6 -0
- data/vendor/activesupport/lib/active_support/json/encoders/regexp.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/string.rb +36 -0
- data/vendor/activesupport/lib/active_support/json/encoders/symbol.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoders/time.rb +21 -0
- data/vendor/activesupport/lib/active_support/json/encoders/true_class.rb +5 -0
- data/vendor/activesupport/lib/active_support/json/encoding.rb +37 -0
- data/vendor/activesupport/lib/active_support/json/variable.rb +10 -0
- data/vendor/activesupport/lib/active_support/locale/en.yml +32 -0
- data/vendor/activesupport/lib/active_support/memoizable.rb +82 -0
- data/vendor/activesupport/lib/active_support/multibyte.rb +33 -0
- data/vendor/activesupport/lib/active_support/multibyte/chars.rb +679 -0
- data/vendor/activesupport/lib/active_support/multibyte/exceptions.rb +8 -0
- data/vendor/activesupport/lib/active_support/multibyte/unicode_database.rb +71 -0
- data/vendor/activesupport/lib/active_support/option_merger.rb +17 -0
- data/vendor/activesupport/lib/active_support/ordered_hash.rb +58 -0
- data/vendor/activesupport/lib/active_support/ordered_options.rb +19 -0
- data/vendor/activesupport/lib/active_support/rescuable.rb +108 -0
- data/vendor/activesupport/lib/active_support/secure_random.rb +197 -0
- data/vendor/activesupport/lib/active_support/string_inquirer.rb +21 -0
- data/vendor/activesupport/lib/active_support/test_case.rb +24 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test.rb +6 -0
- data/vendor/activesupport/lib/active_support/testing/core_ext/test/unit/assertions.rb +72 -0
- data/vendor/activesupport/lib/active_support/testing/default.rb +9 -0
- data/vendor/activesupport/lib/active_support/testing/performance.rb +452 -0
- data/vendor/activesupport/lib/active_support/testing/setup_and_teardown.rb +120 -0
- data/vendor/activesupport/lib/active_support/time_with_zone.rb +328 -0
- data/vendor/activesupport/lib/active_support/values/time_zone.rb +403 -0
- data/vendor/activesupport/lib/active_support/values/unicode_tables.dat +0 -0
- data/vendor/activesupport/lib/active_support/vendor.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb +113 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/blankslate.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/css.rb +250 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xchar.rb +115 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlbase.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlevents.rb +63 -0
- data/vendor/activesupport/lib/active_support/vendor/builder-2.1.2/builder/xmlmarkup.rb +328 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/backend/simple.rb +216 -0
- data/vendor/activesupport/lib/active_support/vendor/i18n-0.0.1/i18n/exceptions.rb +53 -0
- data/vendor/activesupport/lib/active_support/vendor/memcache-client-1.5.1/memcache.rb +849 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/data_timezone_info.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Algiers.rb +55 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Cairo.rb +219 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Casablanca.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Harare.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Johannesburg.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Monrovia.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Africa/Nairobi.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/Buenos_Aires.rb +166 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Argentina/San_Juan.rb +86 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Bogota.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Caracas.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chicago.rb +283 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Chihuahua.rb +136 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Denver.rb +204 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Godthab.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Guatemala.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Halifax.rb +274 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Indiana/Indianapolis.rb +149 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Juneau.rb +194 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/La_Paz.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Lima.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Los_Angeles.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mazatlan.rb +139 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Mexico_City.rb +144 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Monterrey.rb +131 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/New_York.rb +282 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Phoenix.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Regina.rb +74 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Santiago.rb +205 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Sao_Paulo.rb +171 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/St_Johns.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/America/Tijuana.rb +196 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Almaty.rb +67 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baghdad.rb +73 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Baku.rb +161 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Bangkok.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Chongqing.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Colombo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Dhaka.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Hong_Kong.rb +87 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Irkutsk.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jakarta.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Jerusalem.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kabul.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kamchatka.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Karachi.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Katmandu.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kolkata.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Krasnoyarsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuala_Lumpur.rb +31 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Kuwait.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Magadan.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Muscat.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Novosibirsk.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Rangoon.rb +24 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Riyadh.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Seoul.rb +34 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Shanghai.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Singapore.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Taipei.rb +59 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tashkent.rb +47 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tbilisi.rb +78 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tehran.rb +121 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Tokyo.rb +30 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Ulaanbaatar.rb +65 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Urumqi.rb +33 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Vladivostok.rb +164 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yakutsk.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yekaterinburg.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Asia/Yerevan.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Azores.rb +270 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/Cape_Verde.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Atlantic/South_Georgia.rb +18 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Adelaide.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Brisbane.rb +35 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Darwin.rb +29 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Hobart.rb +193 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Melbourne.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Perth.rb +37 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Australia/Sydney.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Etc/UTC.rb +16 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Amsterdam.rb +228 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Athens.rb +185 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Belgrade.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Berlin.rb +188 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bratislava.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Brussels.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Bucharest.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Budapest.rb +197 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Copenhagen.rb +179 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Dublin.rb +276 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Helsinki.rb +163 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Istanbul.rb +218 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Kiev.rb +168 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Lisbon.rb +268 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Ljubljana.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/London.rb +288 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Madrid.rb +211 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Minsk.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Moscow.rb +181 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Paris.rb +232 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Prague.rb +187 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Riga.rb +176 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Rome.rb +215 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sarajevo.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Skopje.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Sofia.rb +173 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Stockholm.rb +165 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Tallinn.rb +172 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vienna.rb +183 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Vilnius.rb +170 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Warsaw.rb +212 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Europe/Zagreb.rb +13 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Auckland.rb +202 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Fiji.rb +23 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Guam.rb +22 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Honolulu.rb +28 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Majuro.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Midway.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Noumea.rb +25 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Pago_Pago.rb +26 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Port_Moresby.rb +20 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/definitions/Pacific/Tongatapu.rb +27 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/info_timezone.rb +52 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone.rb +51 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/linked_timezone_info.rb +44 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/offset_rationals.rb +98 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/ruby_core_support.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb +292 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone.rb +508 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_definition.rb +56 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_info.rb +40 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_offset_info.rb +94 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_period.rb +198 -0
- data/vendor/activesupport/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/timezone_transition_info.rb +129 -0
- data/vendor/activesupport/lib/active_support/vendor/xml-simple-1.0.11/xmlsimple.rb +1021 -0
- data/vendor/activesupport/lib/active_support/version.rb +9 -0
- data/vendor/activesupport/lib/active_support/whiny_nil.rb +58 -0
- data/vendor/activesupport/lib/activesupport.rb +1 -0
- data/vendor/isaac/LICENSE +26 -0
- data/vendor/isaac/README +78 -0
- data/vendor/isaac/TODO +3 -0
- data/vendor/isaac/VERSIONS +3 -0
- data/vendor/isaac/crypt/ISAAC.rb +171 -0
- data/vendor/isaac/isaac.gemspec +39 -0
- data/vendor/isaac/setup.rb +596 -0
- data/vendor/isaac/test/TC_ISAAC.rb +76 -0
- data/vendor/json/CHANGES +93 -0
- data/vendor/json/GPL +340 -0
- data/vendor/json/README +78 -0
- data/vendor/json/RUBY +58 -0
- data/vendor/json/Rakefile +309 -0
- data/vendor/json/TODO +1 -0
- data/vendor/json/VERSION +1 -0
- data/vendor/json/benchmarks/benchmark.txt +133 -0
- data/vendor/json/benchmarks/benchmark_generator.rb +48 -0
- data/vendor/json/benchmarks/benchmark_parser.rb +26 -0
- data/vendor/json/benchmarks/benchmark_rails.rb +26 -0
- data/vendor/json/bin/edit_json.rb +10 -0
- data/vendor/json/bin/prettify_json.rb +76 -0
- data/vendor/json/data/example.json +1 -0
- data/vendor/json/data/index.html +38 -0
- data/vendor/json/data/prototype.js +4184 -0
- data/vendor/json/ext/json/ext/generator/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/generator/generator.c +875 -0
- data/vendor/json/ext/json/ext/generator/unicode.c +182 -0
- data/vendor/json/ext/json/ext/generator/unicode.h +53 -0
- data/vendor/json/ext/json/ext/parser/extconf.rb +9 -0
- data/vendor/json/ext/json/ext/parser/parser.c +1758 -0
- data/vendor/json/ext/json/ext/parser/parser.rl +638 -0
- data/vendor/json/ext/json/ext/parser/unicode.c +154 -0
- data/vendor/json/ext/json/ext/parser/unicode.h +58 -0
- data/vendor/json/install.rb +26 -0
- data/vendor/json/lib/json.rb +235 -0
- data/vendor/json/lib/json/Array.xpm +21 -0
- data/vendor/json/lib/json/FalseClass.xpm +21 -0
- data/vendor/json/lib/json/Hash.xpm +21 -0
- data/vendor/json/lib/json/Key.xpm +73 -0
- data/vendor/json/lib/json/NilClass.xpm +21 -0
- data/vendor/json/lib/json/Numeric.xpm +28 -0
- data/vendor/json/lib/json/String.xpm +96 -0
- data/vendor/json/lib/json/TrueClass.xpm +21 -0
- data/vendor/json/lib/json/add/core.rb +135 -0
- data/vendor/json/lib/json/add/rails.rb +58 -0
- data/vendor/json/lib/json/common.rb +354 -0
- data/vendor/json/lib/json/editor.rb +1362 -0
- data/vendor/json/lib/json/ext.rb +13 -0
- data/vendor/json/lib/json/json.xpm +1499 -0
- data/vendor/json/lib/json/pure.rb +75 -0
- data/vendor/json/lib/json/pure/generator.rb +394 -0
- data/vendor/json/lib/json/pure/parser.rb +259 -0
- data/vendor/json/lib/json/version.rb +9 -0
- data/vendor/json/tests/fixtures/fail1.json +1 -0
- data/vendor/json/tests/fixtures/fail10.json +1 -0
- data/vendor/json/tests/fixtures/fail11.json +1 -0
- data/vendor/json/tests/fixtures/fail12.json +1 -0
- data/vendor/json/tests/fixtures/fail13.json +1 -0
- data/vendor/json/tests/fixtures/fail14.json +1 -0
- data/vendor/json/tests/fixtures/fail18.json +1 -0
- data/vendor/json/tests/fixtures/fail19.json +1 -0
- data/vendor/json/tests/fixtures/fail2.json +1 -0
- data/vendor/json/tests/fixtures/fail20.json +1 -0
- data/vendor/json/tests/fixtures/fail21.json +1 -0
- data/vendor/json/tests/fixtures/fail22.json +1 -0
- data/vendor/json/tests/fixtures/fail23.json +1 -0
- data/vendor/json/tests/fixtures/fail24.json +1 -0
- data/vendor/json/tests/fixtures/fail25.json +1 -0
- data/vendor/json/tests/fixtures/fail27.json +2 -0
- data/vendor/json/tests/fixtures/fail28.json +2 -0
- data/vendor/json/tests/fixtures/fail3.json +1 -0
- data/vendor/json/tests/fixtures/fail4.json +1 -0
- data/vendor/json/tests/fixtures/fail5.json +1 -0
- data/vendor/json/tests/fixtures/fail6.json +1 -0
- data/vendor/json/tests/fixtures/fail7.json +1 -0
- data/vendor/json/tests/fixtures/fail8.json +1 -0
- data/vendor/json/tests/fixtures/fail9.json +1 -0
- data/vendor/json/tests/fixtures/pass1.json +56 -0
- data/vendor/json/tests/fixtures/pass15.json +1 -0
- data/vendor/json/tests/fixtures/pass16.json +1 -0
- data/vendor/json/tests/fixtures/pass17.json +1 -0
- data/vendor/json/tests/fixtures/pass2.json +1 -0
- data/vendor/json/tests/fixtures/pass26.json +1 -0
- data/vendor/json/tests/fixtures/pass3.json +6 -0
- data/vendor/json/tests/runner.rb +25 -0
- data/vendor/json/tests/test_json.rb +293 -0
- data/vendor/json/tests/test_json_addition.rb +161 -0
- data/vendor/json/tests/test_json_fixtures.rb +30 -0
- data/vendor/json/tests/test_json_generate.rb +100 -0
- data/vendor/json/tests/test_json_rails.rb +118 -0
- data/vendor/json/tests/test_json_unicode.rb +61 -0
- data/vendor/json/tools/fuzz.rb +140 -0
- data/vendor/json/tools/server.rb +62 -0
- data/vendor/rack/AUTHORS +8 -0
- data/vendor/rack/COPYING +18 -0
- data/vendor/rack/KNOWN-ISSUES +18 -0
- data/vendor/rack/RDOX +324 -0
- data/vendor/rack/README +306 -0
- data/vendor/rack/Rakefile +188 -0
- data/vendor/rack/SPEC +129 -0
- data/vendor/rack/bin/rackup +172 -0
- data/vendor/rack/contrib/rack_logo.svg +111 -0
- data/vendor/rack/example/lobster.ru +4 -0
- data/vendor/rack/example/protectedlobster.rb +14 -0
- data/vendor/rack/example/protectedlobster.ru +8 -0
- data/vendor/rack/lib/rack.rb +86 -0
- data/vendor/rack/lib/rack/adapter/camping.rb +22 -0
- data/vendor/rack/lib/rack/auth/abstract/handler.rb +28 -0
- data/vendor/rack/lib/rack/auth/abstract/request.rb +37 -0
- data/vendor/rack/lib/rack/auth/basic.rb +58 -0
- data/vendor/rack/lib/rack/auth/digest/md5.rb +124 -0
- data/vendor/rack/lib/rack/auth/digest/nonce.rb +51 -0
- data/vendor/rack/lib/rack/auth/digest/params.rb +55 -0
- data/vendor/rack/lib/rack/auth/digest/request.rb +40 -0
- data/vendor/rack/lib/rack/auth/openid.rb +438 -0
- data/vendor/rack/lib/rack/builder.rb +67 -0
- data/vendor/rack/lib/rack/cascade.rb +36 -0
- data/vendor/rack/lib/rack/commonlogger.rb +61 -0
- data/vendor/rack/lib/rack/conditionalget.rb +43 -0
- data/vendor/rack/lib/rack/content_length.rb +25 -0
- data/vendor/rack/lib/rack/deflater.rb +87 -0
- data/vendor/rack/lib/rack/directory.rb +150 -0
- data/vendor/rack/lib/rack/file.rb +85 -0
- data/vendor/rack/lib/rack/handler.rb +48 -0
- data/vendor/rack/lib/rack/handler/cgi.rb +57 -0
- data/vendor/rack/lib/rack/handler/evented_mongrel.rb +8 -0
- data/vendor/rack/lib/rack/handler/fastcgi.rb +86 -0
- data/vendor/rack/lib/rack/handler/lsws.rb +52 -0
- data/vendor/rack/lib/rack/handler/mongrel.rb +82 -0
- data/vendor/rack/lib/rack/handler/scgi.rb +57 -0
- data/vendor/rack/lib/rack/handler/swiftiplied_mongrel.rb +8 -0
- data/vendor/rack/lib/rack/handler/thin.rb +15 -0
- data/vendor/rack/lib/rack/handler/webrick.rb +61 -0
- data/vendor/rack/lib/rack/head.rb +19 -0
- data/vendor/rack/lib/rack/lint.rb +465 -0
- data/vendor/rack/lib/rack/lobster.rb +65 -0
- data/vendor/rack/lib/rack/methodoverride.rb +27 -0
- data/vendor/rack/lib/rack/mime.rb +204 -0
- data/vendor/rack/lib/rack/mock.rb +160 -0
- data/vendor/rack/lib/rack/recursive.rb +57 -0
- data/vendor/rack/lib/rack/reloader.rb +64 -0
- data/vendor/rack/lib/rack/request.rb +218 -0
- data/vendor/rack/lib/rack/response.rb +171 -0
- data/vendor/rack/lib/rack/session/abstract/id.rb +153 -0
- data/vendor/rack/lib/rack/session/cookie.rb +89 -0
- data/vendor/rack/lib/rack/session/memcache.rb +97 -0
- data/vendor/rack/lib/rack/session/pool.rb +73 -0
- data/vendor/rack/lib/rack/showexceptions.rb +348 -0
- data/vendor/rack/lib/rack/showstatus.rb +106 -0
- data/vendor/rack/lib/rack/static.rb +38 -0
- data/vendor/rack/lib/rack/urlmap.rb +48 -0
- data/vendor/rack/lib/rack/utils.rb +347 -0
- data/vendor/rack/test/cgi/lighttpd.conf +20 -0
- data/vendor/rack/test/cgi/test +9 -0
- data/vendor/rack/test/cgi/test.fcgi +8 -0
- data/vendor/rack/test/cgi/test.ru +7 -0
- data/vendor/rack/test/spec_rack_auth_basic.rb +69 -0
- data/vendor/rack/test/spec_rack_auth_digest.rb +169 -0
- data/vendor/rack/test/spec_rack_auth_openid.rb +137 -0
- data/vendor/rack/test/spec_rack_builder.rb +84 -0
- data/vendor/rack/test/spec_rack_camping.rb +51 -0
- data/vendor/rack/test/spec_rack_cascade.rb +50 -0
- data/vendor/rack/test/spec_rack_cgi.rb +89 -0
- data/vendor/rack/test/spec_rack_commonlogger.rb +32 -0
- data/vendor/rack/test/spec_rack_conditionalget.rb +41 -0
- data/vendor/rack/test/spec_rack_content_length.rb +43 -0
- data/vendor/rack/test/spec_rack_deflater.rb +105 -0
- data/vendor/rack/test/spec_rack_directory.rb +61 -0
- data/vendor/rack/test/spec_rack_fastcgi.rb +89 -0
- data/vendor/rack/test/spec_rack_file.rb +64 -0
- data/vendor/rack/test/spec_rack_handler.rb +24 -0
- data/vendor/rack/test/spec_rack_head.rb +30 -0
- data/vendor/rack/test/spec_rack_lint.rb +380 -0
- data/vendor/rack/test/spec_rack_lobster.rb +45 -0
- data/vendor/rack/test/spec_rack_methodoverride.rb +60 -0
- data/vendor/rack/test/spec_rack_mock.rb +152 -0
- data/vendor/rack/test/spec_rack_mongrel.rb +189 -0
- data/vendor/rack/test/spec_rack_recursive.rb +77 -0
- data/vendor/rack/test/spec_rack_request.rb +446 -0
- data/vendor/rack/test/spec_rack_response.rb +174 -0
- data/vendor/rack/test/spec_rack_session_cookie.rb +82 -0
- data/vendor/rack/test/spec_rack_session_memcache.rb +132 -0
- data/vendor/rack/test/spec_rack_session_pool.rb +84 -0
- data/vendor/rack/test/spec_rack_showexceptions.rb +21 -0
- data/vendor/rack/test/spec_rack_showstatus.rb +72 -0
- data/vendor/rack/test/spec_rack_static.rb +37 -0
- data/vendor/rack/test/spec_rack_thin.rb +90 -0
- data/vendor/rack/test/spec_rack_urlmap.rb +175 -0
- data/vendor/rack/test/spec_rack_utils.rb +176 -0
- data/vendor/rack/test/spec_rack_webrick.rb +123 -0
- data/vendor/rack/test/testrequest.rb +57 -0
- data/vendor/sinatra/AUTHORS +40 -0
- data/vendor/sinatra/CHANGES +189 -0
- data/vendor/sinatra/LICENSE +22 -0
- data/vendor/sinatra/README.rdoc +552 -0
- data/vendor/sinatra/Rakefile +186 -0
- data/vendor/sinatra/compat/app_test.rb +300 -0
- data/vendor/sinatra/compat/application_test.rb +334 -0
- data/vendor/sinatra/compat/builder_test.rb +101 -0
- data/vendor/sinatra/compat/custom_error_test.rb +62 -0
- data/vendor/sinatra/compat/erb_test.rb +136 -0
- data/vendor/sinatra/compat/events_test.rb +78 -0
- data/vendor/sinatra/compat/filter_test.rb +30 -0
- data/vendor/sinatra/compat/haml_test.rb +233 -0
- data/vendor/sinatra/compat/helper.rb +30 -0
- data/vendor/sinatra/compat/mapped_error_test.rb +72 -0
- data/vendor/sinatra/compat/pipeline_test.rb +71 -0
- data/vendor/sinatra/compat/public/foo.xml +1 -0
- data/vendor/sinatra/compat/sass_test.rb +57 -0
- data/vendor/sinatra/compat/sessions_test.rb +39 -0
- data/vendor/sinatra/compat/streaming_test.rb +121 -0
- data/vendor/sinatra/compat/sym_params_test.rb +19 -0
- data/vendor/sinatra/compat/template_test.rb +30 -0
- data/vendor/sinatra/compat/use_in_file_templates_test.rb +47 -0
- data/vendor/sinatra/compat/views/foo.builder +1 -0
- data/vendor/sinatra/compat/views/foo.erb +1 -0
- data/vendor/sinatra/compat/views/foo.haml +1 -0
- data/vendor/sinatra/compat/views/foo.sass +2 -0
- data/vendor/sinatra/compat/views/foo_layout.erb +2 -0
- data/vendor/sinatra/compat/views/foo_layout.haml +2 -0
- data/vendor/sinatra/compat/views/layout_test/foo.builder +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.erb +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.haml +1 -0
- data/vendor/sinatra/compat/views/layout_test/foo.sass +2 -0
- data/vendor/sinatra/compat/views/layout_test/layout.builder +3 -0
- data/vendor/sinatra/compat/views/layout_test/layout.erb +1 -0
- data/vendor/sinatra/compat/views/layout_test/layout.haml +1 -0
- data/vendor/sinatra/compat/views/layout_test/layout.sass +2 -0
- data/vendor/sinatra/compat/views/no_layout/no_layout.builder +1 -0
- data/vendor/sinatra/compat/views/no_layout/no_layout.haml +1 -0
- data/vendor/sinatra/lib/sinatra.rb +8 -0
- data/vendor/sinatra/lib/sinatra/base.rb +843 -0
- data/vendor/sinatra/lib/sinatra/compat.rb +239 -0
- data/vendor/sinatra/lib/sinatra/images/404.png +0 -0
- data/vendor/sinatra/lib/sinatra/images/500.png +0 -0
- data/vendor/sinatra/lib/sinatra/main.rb +48 -0
- data/vendor/sinatra/lib/sinatra/test.rb +114 -0
- data/vendor/sinatra/lib/sinatra/test/bacon.rb +17 -0
- data/vendor/sinatra/lib/sinatra/test/rspec.rb +9 -0
- data/vendor/sinatra/lib/sinatra/test/spec.rb +9 -0
- data/vendor/sinatra/lib/sinatra/test/unit.rb +11 -0
- data/vendor/sinatra/sinatra.gemspec +110 -0
- data/vendor/sinatra/test/base_test.rb +68 -0
- data/vendor/sinatra/test/builder_test.rb +64 -0
- data/vendor/sinatra/test/data/reload_app_file.rb +3 -0
- data/vendor/sinatra/test/erb_test.rb +50 -0
- data/vendor/sinatra/test/filter_test.rb +75 -0
- data/vendor/sinatra/test/haml_test.rb +68 -0
- data/vendor/sinatra/test/helper.rb +25 -0
- data/vendor/sinatra/test/helpers_test.rb +361 -0
- data/vendor/sinatra/test/mapped_error_test.rb +160 -0
- data/vendor/sinatra/test/middleware_test.rb +58 -0
- data/vendor/sinatra/test/options_test.rb +97 -0
- data/vendor/sinatra/test/reload_test.rb +61 -0
- data/vendor/sinatra/test/request_test.rb +18 -0
- data/vendor/sinatra/test/result_test.rb +88 -0
- data/vendor/sinatra/test/routing_test.rb +391 -0
- data/vendor/sinatra/test/sass_test.rb +36 -0
- data/vendor/sinatra/test/sinatra_test.rb +13 -0
- data/vendor/sinatra/test/static_test.rb +57 -0
- data/vendor/sinatra/test/templates_test.rb +88 -0
- data/vendor/sinatra/test/views/hello.builder +1 -0
- data/vendor/sinatra/test/views/hello.erb +1 -0
- data/vendor/sinatra/test/views/hello.haml +1 -0
- data/vendor/sinatra/test/views/hello.sass +2 -0
- data/vendor/sinatra/test/views/hello.test +1 -0
- data/vendor/sinatra/test/views/layout2.builder +3 -0
- data/vendor/sinatra/test/views/layout2.erb +2 -0
- data/vendor/sinatra/test/views/layout2.haml +2 -0
- data/vendor/sinatra/test/views/layout2.test +1 -0
- metadata +1058 -0
@@ -0,0 +1,1101 @@
|
|
1
|
+
require "cases/helper"
|
2
|
+
require 'models/developer'
|
3
|
+
require 'models/project'
|
4
|
+
require 'models/company'
|
5
|
+
require 'models/topic'
|
6
|
+
require 'models/reply'
|
7
|
+
require 'models/category'
|
8
|
+
require 'models/post'
|
9
|
+
require 'models/author'
|
10
|
+
require 'models/comment'
|
11
|
+
require 'models/person'
|
12
|
+
require 'models/reader'
|
13
|
+
|
14
|
+
class HasManyAssociationsTest < ActiveRecord::TestCase
|
15
|
+
fixtures :accounts, :categories, :companies, :developers, :projects,
|
16
|
+
:developers_projects, :topics, :authors, :comments, :author_addresses,
|
17
|
+
:people, :posts, :readers
|
18
|
+
|
19
|
+
def setup
|
20
|
+
Client.destroyed_client_ids.clear
|
21
|
+
end
|
22
|
+
|
23
|
+
def force_signal37_to_load_all_clients_of_firm
|
24
|
+
companies(:first_firm).clients_of_firm.each {|f| }
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_counting_with_counter_sql
|
28
|
+
assert_equal 2, Firm.find(:first).clients.count
|
29
|
+
end
|
30
|
+
|
31
|
+
def test_counting
|
32
|
+
assert_equal 2, Firm.find(:first).plain_clients.count
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_counting_with_empty_hash_conditions
|
36
|
+
assert_equal 2, Firm.find(:first).plain_clients.count(:conditions => {})
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_counting_with_single_conditions
|
40
|
+
assert_equal 1, Firm.find(:first).plain_clients.count(:conditions => ['name=?', "Microsoft"])
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_counting_with_single_hash
|
44
|
+
assert_equal 1, Firm.find(:first).plain_clients.count(:conditions => {:name => "Microsoft"})
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_counting_with_column_name_and_hash
|
48
|
+
assert_equal 2, Firm.find(:first).plain_clients.count(:name)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_counting_with_association_limit
|
52
|
+
firm = companies(:first_firm)
|
53
|
+
assert_equal firm.limited_clients.length, firm.limited_clients.size
|
54
|
+
assert_equal firm.limited_clients.length, firm.limited_clients.count
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_finding
|
58
|
+
assert_equal 2, Firm.find(:first).clients.length
|
59
|
+
end
|
60
|
+
|
61
|
+
def test_find_with_blank_conditions
|
62
|
+
[[], {}, nil, ""].each do |blank|
|
63
|
+
assert_equal 2, Firm.find(:first).clients.find(:all, :conditions => blank).size
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_find_many_with_merged_options
|
68
|
+
assert_equal 1, companies(:first_firm).limited_clients.size
|
69
|
+
assert_equal 1, companies(:first_firm).limited_clients.find(:all).size
|
70
|
+
assert_equal 2, companies(:first_firm).limited_clients.find(:all, :limit => nil).size
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_dynamic_find_should_respect_association_order
|
74
|
+
assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find(:first, :conditions => "type = 'Client'")
|
75
|
+
assert_equal companies(:second_client), companies(:first_firm).clients_sorted_desc.find_by_type('Client')
|
76
|
+
end
|
77
|
+
|
78
|
+
def test_dynamic_find_order_should_override_association_order
|
79
|
+
assert_equal companies(:first_client), companies(:first_firm).clients_sorted_desc.find(:first, :conditions => "type = 'Client'", :order => 'id')
|
80
|
+
assert_equal companies(:first_client), companies(:first_firm).clients_sorted_desc.find_by_type('Client', :order => 'id')
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_dynamic_find_all_should_respect_association_order
|
84
|
+
assert_equal [companies(:second_client), companies(:first_client)], companies(:first_firm).clients_sorted_desc.find(:all, :conditions => "type = 'Client'")
|
85
|
+
assert_equal [companies(:second_client), companies(:first_client)], companies(:first_firm).clients_sorted_desc.find_all_by_type('Client')
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_dynamic_find_all_order_should_override_association_order
|
89
|
+
assert_equal [companies(:first_client), companies(:second_client)], companies(:first_firm).clients_sorted_desc.find(:all, :conditions => "type = 'Client'", :order => 'id')
|
90
|
+
assert_equal [companies(:first_client), companies(:second_client)], companies(:first_firm).clients_sorted_desc.find_all_by_type('Client', :order => 'id')
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_dynamic_find_all_should_respect_association_limit
|
94
|
+
assert_equal 1, companies(:first_firm).limited_clients.find(:all, :conditions => "type = 'Client'").length
|
95
|
+
assert_equal 1, companies(:first_firm).limited_clients.find_all_by_type('Client').length
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_dynamic_find_all_limit_should_override_association_limit
|
99
|
+
assert_equal 2, companies(:first_firm).limited_clients.find(:all, :conditions => "type = 'Client'", :limit => 9_000).length
|
100
|
+
assert_equal 2, companies(:first_firm).limited_clients.find_all_by_type('Client', :limit => 9_000).length
|
101
|
+
end
|
102
|
+
|
103
|
+
def test_dynamic_find_all_should_respect_readonly_access
|
104
|
+
companies(:first_firm).readonly_clients.find(:all).each { |c| assert_raise(ActiveRecord::ReadOnlyRecord) { c.save! } }
|
105
|
+
companies(:first_firm).readonly_clients.find(:all).each { |c| assert c.readonly? }
|
106
|
+
end
|
107
|
+
|
108
|
+
def test_cant_save_has_many_readonly_association
|
109
|
+
authors(:david).readonly_comments.each { |c| assert_raise(ActiveRecord::ReadOnlyRecord) { c.save! } }
|
110
|
+
authors(:david).readonly_comments.each { |c| assert c.readonly? }
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_triple_equality
|
114
|
+
assert !(Array === Firm.find(:first).clients)
|
115
|
+
assert Firm.find(:first).clients === Array
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_finding_default_orders
|
119
|
+
assert_equal "Summit", Firm.find(:first).clients.first.name
|
120
|
+
end
|
121
|
+
|
122
|
+
def test_finding_with_different_class_name_and_order
|
123
|
+
assert_equal "Microsoft", Firm.find(:first).clients_sorted_desc.first.name
|
124
|
+
end
|
125
|
+
|
126
|
+
def test_finding_with_foreign_key
|
127
|
+
assert_equal "Microsoft", Firm.find(:first).clients_of_firm.first.name
|
128
|
+
end
|
129
|
+
|
130
|
+
def test_finding_with_condition
|
131
|
+
assert_equal "Microsoft", Firm.find(:first).clients_like_ms.first.name
|
132
|
+
end
|
133
|
+
|
134
|
+
def test_finding_with_condition_hash
|
135
|
+
assert_equal "Microsoft", Firm.find(:first).clients_like_ms_with_hash_conditions.first.name
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_finding_using_primary_key
|
139
|
+
assert_equal "Summit", Firm.find(:first).clients_using_primary_key.first.name
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_finding_using_sql
|
143
|
+
firm = Firm.find(:first)
|
144
|
+
first_client = firm.clients_using_sql.first
|
145
|
+
assert_not_nil first_client
|
146
|
+
assert_equal "Microsoft", first_client.name
|
147
|
+
assert_equal 1, firm.clients_using_sql.size
|
148
|
+
assert_equal 1, Firm.find(:first).clients_using_sql.size
|
149
|
+
end
|
150
|
+
|
151
|
+
def test_counting_using_sql
|
152
|
+
assert_equal 1, Firm.find(:first).clients_using_counter_sql.size
|
153
|
+
assert Firm.find(:first).clients_using_counter_sql.any?
|
154
|
+
assert_equal 0, Firm.find(:first).clients_using_zero_counter_sql.size
|
155
|
+
assert !Firm.find(:first).clients_using_zero_counter_sql.any?
|
156
|
+
end
|
157
|
+
|
158
|
+
def test_counting_non_existant_items_using_sql
|
159
|
+
assert_equal 0, Firm.find(:first).no_clients_using_counter_sql.size
|
160
|
+
end
|
161
|
+
|
162
|
+
def test_belongs_to_sanity
|
163
|
+
c = Client.new
|
164
|
+
assert_nil c.firm
|
165
|
+
|
166
|
+
if c.firm
|
167
|
+
assert false, "belongs_to failed if check"
|
168
|
+
end
|
169
|
+
|
170
|
+
unless c.firm
|
171
|
+
else
|
172
|
+
assert false, "belongs_to failed unless check"
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def test_find_ids
|
177
|
+
firm = Firm.find(:first)
|
178
|
+
|
179
|
+
assert_raises(ActiveRecord::RecordNotFound) { firm.clients.find }
|
180
|
+
|
181
|
+
client = firm.clients.find(2)
|
182
|
+
assert_kind_of Client, client
|
183
|
+
|
184
|
+
client_ary = firm.clients.find([2])
|
185
|
+
assert_kind_of Array, client_ary
|
186
|
+
assert_equal client, client_ary.first
|
187
|
+
|
188
|
+
client_ary = firm.clients.find(2, 3)
|
189
|
+
assert_kind_of Array, client_ary
|
190
|
+
assert_equal 2, client_ary.size
|
191
|
+
assert_equal client, client_ary.first
|
192
|
+
|
193
|
+
assert_raises(ActiveRecord::RecordNotFound) { firm.clients.find(2, 99) }
|
194
|
+
end
|
195
|
+
|
196
|
+
def test_find_string_ids_when_using_finder_sql
|
197
|
+
firm = Firm.find(:first)
|
198
|
+
|
199
|
+
client = firm.clients_using_finder_sql.find("2")
|
200
|
+
assert_kind_of Client, client
|
201
|
+
|
202
|
+
client_ary = firm.clients_using_finder_sql.find(["2"])
|
203
|
+
assert_kind_of Array, client_ary
|
204
|
+
assert_equal client, client_ary.first
|
205
|
+
|
206
|
+
client_ary = firm.clients_using_finder_sql.find("2", "3")
|
207
|
+
assert_kind_of Array, client_ary
|
208
|
+
assert_equal 2, client_ary.size
|
209
|
+
assert client_ary.include?(client)
|
210
|
+
end
|
211
|
+
|
212
|
+
def test_find_all
|
213
|
+
firm = Firm.find(:first)
|
214
|
+
assert_equal 2, firm.clients.find(:all, :conditions => "#{QUOTED_TYPE} = 'Client'").length
|
215
|
+
assert_equal 1, firm.clients.find(:all, :conditions => "name = 'Summit'").length
|
216
|
+
end
|
217
|
+
|
218
|
+
def test_find_all_sanitized
|
219
|
+
firm = Firm.find(:first)
|
220
|
+
summit = firm.clients.find(:all, :conditions => "name = 'Summit'")
|
221
|
+
assert_equal summit, firm.clients.find(:all, :conditions => ["name = ?", "Summit"])
|
222
|
+
assert_equal summit, firm.clients.find(:all, :conditions => ["name = :name", { :name => "Summit" }])
|
223
|
+
end
|
224
|
+
|
225
|
+
def test_find_first
|
226
|
+
firm = Firm.find(:first)
|
227
|
+
client2 = Client.find(2)
|
228
|
+
assert_equal firm.clients.first, firm.clients.find(:first)
|
229
|
+
assert_equal client2, firm.clients.find(:first, :conditions => "#{QUOTED_TYPE} = 'Client'")
|
230
|
+
end
|
231
|
+
|
232
|
+
def test_find_first_sanitized
|
233
|
+
firm = Firm.find(:first)
|
234
|
+
client2 = Client.find(2)
|
235
|
+
assert_equal client2, firm.clients.find(:first, :conditions => ["#{QUOTED_TYPE} = ?", 'Client'])
|
236
|
+
assert_equal client2, firm.clients.find(:first, :conditions => ["#{QUOTED_TYPE} = :type", { :type => 'Client' }])
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_find_in_collection
|
240
|
+
assert_equal Client.find(2).name, companies(:first_firm).clients.find(2).name
|
241
|
+
assert_raises(ActiveRecord::RecordNotFound) { companies(:first_firm).clients.find(6) }
|
242
|
+
end
|
243
|
+
|
244
|
+
def test_find_grouped
|
245
|
+
all_clients_of_firm1 = Client.find(:all, :conditions => "firm_id = 1")
|
246
|
+
grouped_clients_of_firm1 = Client.find(:all, :conditions => "firm_id = 1", :group => "firm_id", :select => 'firm_id, count(id) as clients_count')
|
247
|
+
assert_equal 2, all_clients_of_firm1.size
|
248
|
+
assert_equal 1, grouped_clients_of_firm1.size
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_find_scoped_grouped
|
252
|
+
assert_equal 1, companies(:first_firm).clients_grouped_by_firm_id.size
|
253
|
+
assert_equal 1, companies(:first_firm).clients_grouped_by_firm_id.length
|
254
|
+
assert_equal 2, companies(:first_firm).clients_grouped_by_name.size
|
255
|
+
assert_equal 2, companies(:first_firm).clients_grouped_by_name.length
|
256
|
+
end
|
257
|
+
|
258
|
+
def test_adding
|
259
|
+
force_signal37_to_load_all_clients_of_firm
|
260
|
+
natural = Client.new("name" => "Natural Company")
|
261
|
+
companies(:first_firm).clients_of_firm << natural
|
262
|
+
assert_equal 2, companies(:first_firm).clients_of_firm.size # checking via the collection
|
263
|
+
assert_equal 2, companies(:first_firm).clients_of_firm(true).size # checking using the db
|
264
|
+
assert_equal natural, companies(:first_firm).clients_of_firm.last
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_adding_using_create
|
268
|
+
first_firm = companies(:first_firm)
|
269
|
+
assert_equal 2, first_firm.plain_clients.size
|
270
|
+
natural = first_firm.plain_clients.create(:name => "Natural Company")
|
271
|
+
assert_equal 3, first_firm.plain_clients.length
|
272
|
+
assert_equal 3, first_firm.plain_clients.size
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_create_with_bang_on_has_many_when_parent_is_new_raises
|
276
|
+
assert_raises(ActiveRecord::RecordNotSaved) do
|
277
|
+
firm = Firm.new
|
278
|
+
firm.plain_clients.create! :name=>"Whoever"
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
def test_regular_create_on_has_many_when_parent_is_new_raises
|
283
|
+
assert_raises(ActiveRecord::RecordNotSaved) do
|
284
|
+
firm = Firm.new
|
285
|
+
firm.plain_clients.create :name=>"Whoever"
|
286
|
+
end
|
287
|
+
end
|
288
|
+
|
289
|
+
def test_create_with_bang_on_has_many_raises_when_record_not_saved
|
290
|
+
assert_raises(ActiveRecord::RecordInvalid) do
|
291
|
+
firm = Firm.find(:first)
|
292
|
+
firm.plain_clients.create!
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
def test_create_with_bang_on_habtm_when_parent_is_new_raises
|
297
|
+
assert_raises(ActiveRecord::RecordNotSaved) do
|
298
|
+
Developer.new("name" => "Aredridel").projects.create!
|
299
|
+
end
|
300
|
+
end
|
301
|
+
|
302
|
+
def test_adding_a_mismatch_class
|
303
|
+
assert_raises(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << nil }
|
304
|
+
assert_raises(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << 1 }
|
305
|
+
assert_raises(ActiveRecord::AssociationTypeMismatch) { companies(:first_firm).clients_of_firm << Topic.find(1) }
|
306
|
+
end
|
307
|
+
|
308
|
+
def test_adding_a_collection
|
309
|
+
force_signal37_to_load_all_clients_of_firm
|
310
|
+
companies(:first_firm).clients_of_firm.concat([Client.new("name" => "Natural Company"), Client.new("name" => "Apple")])
|
311
|
+
assert_equal 3, companies(:first_firm).clients_of_firm.size
|
312
|
+
assert_equal 3, companies(:first_firm).clients_of_firm(true).size
|
313
|
+
end
|
314
|
+
|
315
|
+
def test_adding_before_save
|
316
|
+
no_of_firms = Firm.count
|
317
|
+
no_of_clients = Client.count
|
318
|
+
|
319
|
+
new_firm = Firm.new("name" => "A New Firm, Inc")
|
320
|
+
c = Client.new("name" => "Apple")
|
321
|
+
|
322
|
+
new_firm.clients_of_firm.push Client.new("name" => "Natural Company")
|
323
|
+
assert_equal 1, new_firm.clients_of_firm.size
|
324
|
+
new_firm.clients_of_firm << c
|
325
|
+
assert_equal 2, new_firm.clients_of_firm.size
|
326
|
+
|
327
|
+
assert_equal no_of_firms, Firm.count # Firm was not saved to database.
|
328
|
+
assert_equal no_of_clients, Client.count # Clients were not saved to database.
|
329
|
+
assert new_firm.save
|
330
|
+
assert !new_firm.new_record?
|
331
|
+
assert !c.new_record?
|
332
|
+
assert_equal new_firm, c.firm
|
333
|
+
assert_equal no_of_firms+1, Firm.count # Firm was saved to database.
|
334
|
+
assert_equal no_of_clients+2, Client.count # Clients were saved to database.
|
335
|
+
|
336
|
+
assert_equal 2, new_firm.clients_of_firm.size
|
337
|
+
assert_equal 2, new_firm.clients_of_firm(true).size
|
338
|
+
end
|
339
|
+
|
340
|
+
def test_invalid_adding
|
341
|
+
firm = Firm.find(1)
|
342
|
+
assert !(firm.clients_of_firm << c = Client.new)
|
343
|
+
assert c.new_record?
|
344
|
+
assert !firm.valid?
|
345
|
+
assert !firm.save
|
346
|
+
assert c.new_record?
|
347
|
+
end
|
348
|
+
|
349
|
+
def test_invalid_adding_before_save
|
350
|
+
no_of_firms = Firm.count
|
351
|
+
no_of_clients = Client.count
|
352
|
+
new_firm = Firm.new("name" => "A New Firm, Inc")
|
353
|
+
new_firm.clients_of_firm.concat([c = Client.new, Client.new("name" => "Apple")])
|
354
|
+
assert c.new_record?
|
355
|
+
assert !c.valid?
|
356
|
+
assert !new_firm.valid?
|
357
|
+
assert !new_firm.save
|
358
|
+
assert c.new_record?
|
359
|
+
assert new_firm.new_record?
|
360
|
+
end
|
361
|
+
|
362
|
+
def test_invalid_adding_with_validate_false
|
363
|
+
firm = Firm.find(:first)
|
364
|
+
client = Client.new
|
365
|
+
firm.unvalidated_clients_of_firm << client
|
366
|
+
|
367
|
+
assert firm.valid?
|
368
|
+
assert !client.valid?
|
369
|
+
assert firm.save
|
370
|
+
assert client.new_record?
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_valid_adding_with_validate_false
|
374
|
+
no_of_clients = Client.count
|
375
|
+
|
376
|
+
firm = Firm.find(:first)
|
377
|
+
client = Client.new("name" => "Apple")
|
378
|
+
|
379
|
+
assert firm.valid?
|
380
|
+
assert client.valid?
|
381
|
+
assert client.new_record?
|
382
|
+
|
383
|
+
firm.unvalidated_clients_of_firm << client
|
384
|
+
|
385
|
+
assert firm.save
|
386
|
+
assert !client.new_record?
|
387
|
+
assert_equal no_of_clients+1, Client.count
|
388
|
+
end
|
389
|
+
|
390
|
+
def test_build
|
391
|
+
company = companies(:first_firm)
|
392
|
+
new_client = assert_no_queries { company.clients_of_firm.build("name" => "Another Client") }
|
393
|
+
assert !company.clients_of_firm.loaded?
|
394
|
+
|
395
|
+
assert_equal "Another Client", new_client.name
|
396
|
+
assert new_client.new_record?
|
397
|
+
assert_equal new_client, company.clients_of_firm.last
|
398
|
+
company.name += '-changed'
|
399
|
+
assert_queries(2) { assert company.save }
|
400
|
+
assert !new_client.new_record?
|
401
|
+
assert_equal 2, company.clients_of_firm(true).size
|
402
|
+
end
|
403
|
+
|
404
|
+
def test_collection_size_after_building
|
405
|
+
company = companies(:first_firm) # company already has one client
|
406
|
+
company.clients_of_firm.build("name" => "Another Client")
|
407
|
+
company.clients_of_firm.build("name" => "Yet Another Client")
|
408
|
+
assert_equal 3, company.clients_of_firm.size
|
409
|
+
end
|
410
|
+
|
411
|
+
def test_collection_size_twice_for_regressions
|
412
|
+
post = posts(:thinking)
|
413
|
+
assert_equal 0, post.readers.size
|
414
|
+
# This test needs a post that has no readers, we assert it to ensure it holds,
|
415
|
+
# but need to reload the post because the very call to #size hides the bug.
|
416
|
+
post.reload
|
417
|
+
post.readers.build
|
418
|
+
size1 = post.readers.size
|
419
|
+
size2 = post.readers.size
|
420
|
+
assert_equal size1, size2
|
421
|
+
end
|
422
|
+
|
423
|
+
def test_build_many
|
424
|
+
company = companies(:first_firm)
|
425
|
+
new_clients = assert_no_queries { company.clients_of_firm.build([{"name" => "Another Client"}, {"name" => "Another Client II"}]) }
|
426
|
+
|
427
|
+
assert_equal 2, new_clients.size
|
428
|
+
company.name += '-changed'
|
429
|
+
assert_queries(3) { assert company.save }
|
430
|
+
assert_equal 3, company.clients_of_firm(true).size
|
431
|
+
end
|
432
|
+
|
433
|
+
def test_build_followed_by_save_does_not_load_target
|
434
|
+
new_client = companies(:first_firm).clients_of_firm.build("name" => "Another Client")
|
435
|
+
assert companies(:first_firm).save
|
436
|
+
assert !companies(:first_firm).clients_of_firm.loaded?
|
437
|
+
end
|
438
|
+
|
439
|
+
def test_build_without_loading_association
|
440
|
+
first_topic = topics(:first)
|
441
|
+
Reply.column_names
|
442
|
+
|
443
|
+
assert_equal 1, first_topic.replies.length
|
444
|
+
|
445
|
+
assert_no_queries do
|
446
|
+
first_topic.replies.build(:title => "Not saved", :content => "Superstars")
|
447
|
+
assert_equal 2, first_topic.replies.size
|
448
|
+
end
|
449
|
+
|
450
|
+
assert_equal 2, first_topic.replies.to_ary.size
|
451
|
+
end
|
452
|
+
|
453
|
+
def test_build_via_block
|
454
|
+
company = companies(:first_firm)
|
455
|
+
new_client = assert_no_queries { company.clients_of_firm.build {|client| client.name = "Another Client" } }
|
456
|
+
assert !company.clients_of_firm.loaded?
|
457
|
+
|
458
|
+
assert_equal "Another Client", new_client.name
|
459
|
+
assert new_client.new_record?
|
460
|
+
assert_equal new_client, company.clients_of_firm.last
|
461
|
+
company.name += '-changed'
|
462
|
+
assert_queries(2) { assert company.save }
|
463
|
+
assert !new_client.new_record?
|
464
|
+
assert_equal 2, company.clients_of_firm(true).size
|
465
|
+
end
|
466
|
+
|
467
|
+
def test_build_many_via_block
|
468
|
+
company = companies(:first_firm)
|
469
|
+
new_clients = assert_no_queries do
|
470
|
+
company.clients_of_firm.build([{"name" => "Another Client"}, {"name" => "Another Client II"}]) do |client|
|
471
|
+
client.name = "changed"
|
472
|
+
end
|
473
|
+
end
|
474
|
+
|
475
|
+
assert_equal 2, new_clients.size
|
476
|
+
assert_equal "changed", new_clients.first.name
|
477
|
+
assert_equal "changed", new_clients.last.name
|
478
|
+
|
479
|
+
company.name += '-changed'
|
480
|
+
assert_queries(3) { assert company.save }
|
481
|
+
assert_equal 3, company.clients_of_firm(true).size
|
482
|
+
end
|
483
|
+
|
484
|
+
def test_create_without_loading_association
|
485
|
+
first_firm = companies(:first_firm)
|
486
|
+
Firm.column_names
|
487
|
+
Client.column_names
|
488
|
+
|
489
|
+
assert_equal 1, first_firm.clients_of_firm.size
|
490
|
+
first_firm.clients_of_firm.reset
|
491
|
+
|
492
|
+
assert_queries(1) do
|
493
|
+
first_firm.clients_of_firm.create(:name => "Superstars")
|
494
|
+
end
|
495
|
+
|
496
|
+
assert_equal 2, first_firm.clients_of_firm.size
|
497
|
+
end
|
498
|
+
|
499
|
+
def test_invalid_build
|
500
|
+
new_client = companies(:first_firm).clients_of_firm.build
|
501
|
+
assert new_client.new_record?
|
502
|
+
assert !new_client.valid?
|
503
|
+
assert_equal new_client, companies(:first_firm).clients_of_firm.last
|
504
|
+
assert !companies(:first_firm).save
|
505
|
+
assert new_client.new_record?
|
506
|
+
assert_equal 1, companies(:first_firm).clients_of_firm(true).size
|
507
|
+
end
|
508
|
+
|
509
|
+
def test_create
|
510
|
+
force_signal37_to_load_all_clients_of_firm
|
511
|
+
new_client = companies(:first_firm).clients_of_firm.create("name" => "Another Client")
|
512
|
+
assert !new_client.new_record?
|
513
|
+
assert_equal new_client, companies(:first_firm).clients_of_firm.last
|
514
|
+
assert_equal new_client, companies(:first_firm).clients_of_firm(true).last
|
515
|
+
end
|
516
|
+
|
517
|
+
def test_create_many
|
518
|
+
companies(:first_firm).clients_of_firm.create([{"name" => "Another Client"}, {"name" => "Another Client II"}])
|
519
|
+
assert_equal 3, companies(:first_firm).clients_of_firm(true).size
|
520
|
+
end
|
521
|
+
|
522
|
+
def test_create_followed_by_save_does_not_load_target
|
523
|
+
new_client = companies(:first_firm).clients_of_firm.create("name" => "Another Client")
|
524
|
+
assert companies(:first_firm).save
|
525
|
+
assert !companies(:first_firm).clients_of_firm.loaded?
|
526
|
+
end
|
527
|
+
|
528
|
+
def test_find_or_initialize
|
529
|
+
the_client = companies(:first_firm).clients.find_or_initialize_by_name("Yet another client")
|
530
|
+
assert_equal companies(:first_firm).id, the_client.firm_id
|
531
|
+
assert_equal "Yet another client", the_client.name
|
532
|
+
assert the_client.new_record?
|
533
|
+
end
|
534
|
+
|
535
|
+
def test_find_or_create
|
536
|
+
number_of_clients = companies(:first_firm).clients.size
|
537
|
+
the_client = companies(:first_firm).clients.find_or_create_by_name("Yet another client")
|
538
|
+
assert_equal number_of_clients + 1, companies(:first_firm, :reload).clients.size
|
539
|
+
assert_equal the_client, companies(:first_firm).clients.find_or_create_by_name("Yet another client")
|
540
|
+
assert_equal number_of_clients + 1, companies(:first_firm, :reload).clients.size
|
541
|
+
end
|
542
|
+
|
543
|
+
def test_deleting
|
544
|
+
force_signal37_to_load_all_clients_of_firm
|
545
|
+
companies(:first_firm).clients_of_firm.delete(companies(:first_firm).clients_of_firm.first)
|
546
|
+
assert_equal 0, companies(:first_firm).clients_of_firm.size
|
547
|
+
assert_equal 0, companies(:first_firm).clients_of_firm(true).size
|
548
|
+
end
|
549
|
+
|
550
|
+
def test_deleting_before_save
|
551
|
+
new_firm = Firm.new("name" => "A New Firm, Inc.")
|
552
|
+
new_client = new_firm.clients_of_firm.build("name" => "Another Client")
|
553
|
+
assert_equal 1, new_firm.clients_of_firm.size
|
554
|
+
new_firm.clients_of_firm.delete(new_client)
|
555
|
+
assert_equal 0, new_firm.clients_of_firm.size
|
556
|
+
end
|
557
|
+
|
558
|
+
def test_deleting_a_collection
|
559
|
+
force_signal37_to_load_all_clients_of_firm
|
560
|
+
companies(:first_firm).clients_of_firm.create("name" => "Another Client")
|
561
|
+
assert_equal 2, companies(:first_firm).clients_of_firm.size
|
562
|
+
companies(:first_firm).clients_of_firm.delete([companies(:first_firm).clients_of_firm[0], companies(:first_firm).clients_of_firm[1]])
|
563
|
+
assert_equal 0, companies(:first_firm).clients_of_firm.size
|
564
|
+
assert_equal 0, companies(:first_firm).clients_of_firm(true).size
|
565
|
+
end
|
566
|
+
|
567
|
+
def test_delete_all
|
568
|
+
force_signal37_to_load_all_clients_of_firm
|
569
|
+
companies(:first_firm).clients_of_firm.create("name" => "Another Client")
|
570
|
+
assert_equal 2, companies(:first_firm).clients_of_firm.size
|
571
|
+
companies(:first_firm).clients_of_firm.delete_all
|
572
|
+
assert_equal 0, companies(:first_firm).clients_of_firm.size
|
573
|
+
assert_equal 0, companies(:first_firm).clients_of_firm(true).size
|
574
|
+
end
|
575
|
+
|
576
|
+
def test_delete_all_with_not_yet_loaded_association_collection
|
577
|
+
force_signal37_to_load_all_clients_of_firm
|
578
|
+
companies(:first_firm).clients_of_firm.create("name" => "Another Client")
|
579
|
+
assert_equal 2, companies(:first_firm).clients_of_firm.size
|
580
|
+
companies(:first_firm).clients_of_firm.reset
|
581
|
+
companies(:first_firm).clients_of_firm.delete_all
|
582
|
+
assert_equal 0, companies(:first_firm).clients_of_firm.size
|
583
|
+
assert_equal 0, companies(:first_firm).clients_of_firm(true).size
|
584
|
+
end
|
585
|
+
|
586
|
+
def test_clearing_an_association_collection
|
587
|
+
firm = companies(:first_firm)
|
588
|
+
client_id = firm.clients_of_firm.first.id
|
589
|
+
assert_equal 1, firm.clients_of_firm.size
|
590
|
+
|
591
|
+
firm.clients_of_firm.clear
|
592
|
+
|
593
|
+
assert_equal 0, firm.clients_of_firm.size
|
594
|
+
assert_equal 0, firm.clients_of_firm(true).size
|
595
|
+
assert_equal [], Client.destroyed_client_ids[firm.id]
|
596
|
+
|
597
|
+
# Should not be destroyed since the association is not dependent.
|
598
|
+
assert_nothing_raised do
|
599
|
+
assert Client.find(client_id).firm.nil?
|
600
|
+
end
|
601
|
+
end
|
602
|
+
|
603
|
+
def test_clearing_a_dependent_association_collection
|
604
|
+
firm = companies(:first_firm)
|
605
|
+
client_id = firm.dependent_clients_of_firm.first.id
|
606
|
+
assert_equal 1, firm.dependent_clients_of_firm.size
|
607
|
+
|
608
|
+
# :dependent means destroy is called on each client
|
609
|
+
firm.dependent_clients_of_firm.clear
|
610
|
+
|
611
|
+
assert_equal 0, firm.dependent_clients_of_firm.size
|
612
|
+
assert_equal 0, firm.dependent_clients_of_firm(true).size
|
613
|
+
assert_equal [client_id], Client.destroyed_client_ids[firm.id]
|
614
|
+
|
615
|
+
# Should be destroyed since the association is dependent.
|
616
|
+
assert Client.find_by_id(client_id).nil?
|
617
|
+
end
|
618
|
+
|
619
|
+
def test_clearing_an_exclusively_dependent_association_collection
|
620
|
+
firm = companies(:first_firm)
|
621
|
+
client_id = firm.exclusively_dependent_clients_of_firm.first.id
|
622
|
+
assert_equal 1, firm.exclusively_dependent_clients_of_firm.size
|
623
|
+
|
624
|
+
assert_equal [], Client.destroyed_client_ids[firm.id]
|
625
|
+
|
626
|
+
# :exclusively_dependent means each client is deleted directly from
|
627
|
+
# the database without looping through them calling destroy.
|
628
|
+
firm.exclusively_dependent_clients_of_firm.clear
|
629
|
+
|
630
|
+
assert_equal 0, firm.exclusively_dependent_clients_of_firm.size
|
631
|
+
assert_equal 0, firm.exclusively_dependent_clients_of_firm(true).size
|
632
|
+
# no destroy-filters should have been called
|
633
|
+
assert_equal [], Client.destroyed_client_ids[firm.id]
|
634
|
+
|
635
|
+
# Should be destroyed since the association is exclusively dependent.
|
636
|
+
assert Client.find_by_id(client_id).nil?
|
637
|
+
end
|
638
|
+
|
639
|
+
def test_dependent_association_respects_optional_conditions_on_delete
|
640
|
+
firm = companies(:odegy)
|
641
|
+
Client.create(:client_of => firm.id, :name => "BigShot Inc.")
|
642
|
+
Client.create(:client_of => firm.id, :name => "SmallTime Inc.")
|
643
|
+
# only one of two clients is included in the association due to the :conditions key
|
644
|
+
assert_equal 2, Client.find_all_by_client_of(firm.id).size
|
645
|
+
assert_equal 1, firm.dependent_conditional_clients_of_firm.size
|
646
|
+
firm.destroy
|
647
|
+
# only the correctly associated client should have been deleted
|
648
|
+
assert_equal 1, Client.find_all_by_client_of(firm.id).size
|
649
|
+
end
|
650
|
+
|
651
|
+
def test_dependent_association_respects_optional_sanitized_conditions_on_delete
|
652
|
+
firm = companies(:odegy)
|
653
|
+
Client.create(:client_of => firm.id, :name => "BigShot Inc.")
|
654
|
+
Client.create(:client_of => firm.id, :name => "SmallTime Inc.")
|
655
|
+
# only one of two clients is included in the association due to the :conditions key
|
656
|
+
assert_equal 2, Client.find_all_by_client_of(firm.id).size
|
657
|
+
assert_equal 1, firm.dependent_sanitized_conditional_clients_of_firm.size
|
658
|
+
firm.destroy
|
659
|
+
# only the correctly associated client should have been deleted
|
660
|
+
assert_equal 1, Client.find_all_by_client_of(firm.id).size
|
661
|
+
end
|
662
|
+
|
663
|
+
def test_creation_respects_hash_condition
|
664
|
+
ms_client = companies(:first_firm).clients_like_ms_with_hash_conditions.build
|
665
|
+
|
666
|
+
assert ms_client.save
|
667
|
+
assert_equal 'Microsoft', ms_client.name
|
668
|
+
|
669
|
+
another_ms_client = companies(:first_firm).clients_like_ms_with_hash_conditions.create
|
670
|
+
|
671
|
+
assert !another_ms_client.new_record?
|
672
|
+
assert_equal 'Microsoft', another_ms_client.name
|
673
|
+
end
|
674
|
+
|
675
|
+
def test_dependent_delete_and_destroy_with_belongs_to
|
676
|
+
author_address = author_addresses(:david_address)
|
677
|
+
assert_equal [], AuthorAddress.destroyed_author_address_ids[authors(:david).id]
|
678
|
+
|
679
|
+
assert_difference "AuthorAddress.count", -2 do
|
680
|
+
authors(:david).destroy
|
681
|
+
end
|
682
|
+
|
683
|
+
assert_equal [author_address.id], AuthorAddress.destroyed_author_address_ids[authors(:david).id]
|
684
|
+
end
|
685
|
+
|
686
|
+
def test_invalid_belongs_to_dependent_option_raises_exception
|
687
|
+
assert_raises ArgumentError do
|
688
|
+
Author.belongs_to :special_author_address, :dependent => :nullify
|
689
|
+
end
|
690
|
+
end
|
691
|
+
|
692
|
+
def test_clearing_without_initial_access
|
693
|
+
firm = companies(:first_firm)
|
694
|
+
|
695
|
+
firm.clients_of_firm.clear
|
696
|
+
|
697
|
+
assert_equal 0, firm.clients_of_firm.size
|
698
|
+
assert_equal 0, firm.clients_of_firm(true).size
|
699
|
+
end
|
700
|
+
|
701
|
+
def test_deleting_a_item_which_is_not_in_the_collection
|
702
|
+
force_signal37_to_load_all_clients_of_firm
|
703
|
+
summit = Client.find_by_name('Summit')
|
704
|
+
companies(:first_firm).clients_of_firm.delete(summit)
|
705
|
+
assert_equal 1, companies(:first_firm).clients_of_firm.size
|
706
|
+
assert_equal 1, companies(:first_firm).clients_of_firm(true).size
|
707
|
+
assert_equal 2, summit.client_of
|
708
|
+
end
|
709
|
+
|
710
|
+
def test_deleting_type_mismatch
|
711
|
+
david = Developer.find(1)
|
712
|
+
david.projects.reload
|
713
|
+
assert_raises(ActiveRecord::AssociationTypeMismatch) { david.projects.delete(1) }
|
714
|
+
end
|
715
|
+
|
716
|
+
def test_deleting_self_type_mismatch
|
717
|
+
david = Developer.find(1)
|
718
|
+
david.projects.reload
|
719
|
+
assert_raises(ActiveRecord::AssociationTypeMismatch) { david.projects.delete(Project.find(1).developers) }
|
720
|
+
end
|
721
|
+
|
722
|
+
def test_destroy_all
|
723
|
+
force_signal37_to_load_all_clients_of_firm
|
724
|
+
assert !companies(:first_firm).clients_of_firm.empty?, "37signals has clients after load"
|
725
|
+
companies(:first_firm).clients_of_firm.destroy_all
|
726
|
+
assert companies(:first_firm).clients_of_firm.empty?, "37signals has no clients after destroy all"
|
727
|
+
assert companies(:first_firm).clients_of_firm(true).empty?, "37signals has no clients after destroy all and refresh"
|
728
|
+
end
|
729
|
+
|
730
|
+
def test_dependence
|
731
|
+
firm = companies(:first_firm)
|
732
|
+
assert_equal 2, firm.clients.size
|
733
|
+
firm.destroy
|
734
|
+
assert Client.find(:all, :conditions => "firm_id=#{firm.id}").empty?
|
735
|
+
end
|
736
|
+
|
737
|
+
def test_destroy_dependent_when_deleted_from_association
|
738
|
+
firm = Firm.find(:first)
|
739
|
+
assert_equal 2, firm.clients.size
|
740
|
+
|
741
|
+
client = firm.clients.first
|
742
|
+
firm.clients.delete(client)
|
743
|
+
|
744
|
+
assert_raise(ActiveRecord::RecordNotFound) { Client.find(client.id) }
|
745
|
+
assert_raise(ActiveRecord::RecordNotFound) { firm.clients.find(client.id) }
|
746
|
+
assert_equal 1, firm.clients.size
|
747
|
+
end
|
748
|
+
|
749
|
+
def test_three_levels_of_dependence
|
750
|
+
topic = Topic.create "title" => "neat and simple"
|
751
|
+
reply = topic.replies.create "title" => "neat and simple", "content" => "still digging it"
|
752
|
+
silly_reply = reply.replies.create "title" => "neat and simple", "content" => "ain't complaining"
|
753
|
+
|
754
|
+
assert_nothing_raised { topic.destroy }
|
755
|
+
end
|
756
|
+
|
757
|
+
uses_transaction :test_dependence_with_transaction_support_on_failure
|
758
|
+
def test_dependence_with_transaction_support_on_failure
|
759
|
+
firm = companies(:first_firm)
|
760
|
+
clients = firm.clients
|
761
|
+
assert_equal 2, clients.length
|
762
|
+
clients.last.instance_eval { def before_destroy() raise "Trigger rollback" end }
|
763
|
+
|
764
|
+
firm.destroy rescue "do nothing"
|
765
|
+
|
766
|
+
assert_equal 2, Client.find(:all, :conditions => "firm_id=#{firm.id}").size
|
767
|
+
end
|
768
|
+
|
769
|
+
def test_dependence_on_account
|
770
|
+
num_accounts = Account.count
|
771
|
+
companies(:first_firm).destroy
|
772
|
+
assert_equal num_accounts - 1, Account.count
|
773
|
+
end
|
774
|
+
|
775
|
+
def test_depends_and_nullify
|
776
|
+
num_accounts = Account.count
|
777
|
+
num_companies = Company.count
|
778
|
+
|
779
|
+
core = companies(:rails_core)
|
780
|
+
assert_equal accounts(:rails_core_account), core.account
|
781
|
+
assert_equal companies(:leetsoft, :jadedpixel), core.companies
|
782
|
+
core.destroy
|
783
|
+
assert_nil accounts(:rails_core_account).reload.firm_id
|
784
|
+
assert_nil companies(:leetsoft).reload.client_of
|
785
|
+
assert_nil companies(:jadedpixel).reload.client_of
|
786
|
+
|
787
|
+
|
788
|
+
assert_equal num_accounts, Account.count
|
789
|
+
end
|
790
|
+
|
791
|
+
def test_included_in_collection
|
792
|
+
assert companies(:first_firm).clients.include?(Client.find(2))
|
793
|
+
end
|
794
|
+
|
795
|
+
def test_adding_array_and_collection
|
796
|
+
assert_nothing_raised { Firm.find(:first).clients + Firm.find(:all).last.clients }
|
797
|
+
end
|
798
|
+
|
799
|
+
def test_find_all_without_conditions
|
800
|
+
firm = companies(:first_firm)
|
801
|
+
assert_equal 2, firm.clients.find(:all).length
|
802
|
+
end
|
803
|
+
|
804
|
+
def test_replace_with_less
|
805
|
+
firm = Firm.find(:first)
|
806
|
+
firm.clients = [companies(:first_client)]
|
807
|
+
assert firm.save, "Could not save firm"
|
808
|
+
firm.reload
|
809
|
+
assert_equal 1, firm.clients.length
|
810
|
+
end
|
811
|
+
|
812
|
+
def test_replace_with_less_and_dependent_nullify
|
813
|
+
num_companies = Company.count
|
814
|
+
companies(:rails_core).companies = []
|
815
|
+
assert_equal num_companies, Company.count
|
816
|
+
end
|
817
|
+
|
818
|
+
def test_replace_with_new
|
819
|
+
firm = Firm.find(:first)
|
820
|
+
firm.clients = [companies(:second_client), Client.new("name" => "New Client")]
|
821
|
+
firm.save
|
822
|
+
firm.reload
|
823
|
+
assert_equal 2, firm.clients.length
|
824
|
+
assert !firm.clients.include?(:first_client)
|
825
|
+
end
|
826
|
+
|
827
|
+
def test_replace_on_new_object
|
828
|
+
firm = Firm.new("name" => "New Firm")
|
829
|
+
firm.clients = [companies(:second_client), Client.new("name" => "New Client")]
|
830
|
+
assert firm.save
|
831
|
+
firm.reload
|
832
|
+
assert_equal 2, firm.clients.length
|
833
|
+
assert firm.clients.include?(Client.find_by_name("New Client"))
|
834
|
+
end
|
835
|
+
|
836
|
+
def test_get_ids
|
837
|
+
assert_equal [companies(:first_client).id, companies(:second_client).id], companies(:first_firm).client_ids
|
838
|
+
end
|
839
|
+
|
840
|
+
def test_get_ids_for_loaded_associations
|
841
|
+
company = companies(:first_firm)
|
842
|
+
company.clients(true)
|
843
|
+
assert_queries(0) do
|
844
|
+
company.client_ids
|
845
|
+
company.client_ids
|
846
|
+
end
|
847
|
+
end
|
848
|
+
|
849
|
+
def test_get_ids_for_unloaded_associations_does_not_load_them
|
850
|
+
company = companies(:first_firm)
|
851
|
+
assert !company.clients.loaded?
|
852
|
+
assert_equal [companies(:first_client).id, companies(:second_client).id], company.client_ids
|
853
|
+
assert !company.clients.loaded?
|
854
|
+
end
|
855
|
+
|
856
|
+
def test_get_ids_for_unloaded_finder_sql_associations_loads_them
|
857
|
+
company = companies(:first_firm)
|
858
|
+
assert !company.clients_using_sql.loaded?
|
859
|
+
assert_equal [companies(:second_client).id], company.clients_using_sql_ids
|
860
|
+
assert company.clients_using_sql.loaded?
|
861
|
+
end
|
862
|
+
|
863
|
+
def test_assign_ids
|
864
|
+
firm = Firm.new("name" => "Apple")
|
865
|
+
firm.client_ids = [companies(:first_client).id, companies(:second_client).id]
|
866
|
+
firm.save
|
867
|
+
firm.reload
|
868
|
+
assert_equal 2, firm.clients.length
|
869
|
+
assert firm.clients.include?(companies(:second_client))
|
870
|
+
end
|
871
|
+
|
872
|
+
def test_assign_ids_ignoring_blanks
|
873
|
+
firm = Firm.create!(:name => 'Apple')
|
874
|
+
firm.client_ids = [companies(:first_client).id, nil, companies(:second_client).id, '']
|
875
|
+
firm.save!
|
876
|
+
|
877
|
+
assert_equal 2, firm.clients(true).size
|
878
|
+
assert firm.clients.include?(companies(:second_client))
|
879
|
+
end
|
880
|
+
|
881
|
+
def test_get_ids_for_through
|
882
|
+
assert_equal [comments(:eager_other_comment1).id], authors(:mary).comment_ids
|
883
|
+
end
|
884
|
+
|
885
|
+
def test_modifying_a_through_a_has_many_should_raise
|
886
|
+
[
|
887
|
+
lambda { authors(:mary).comment_ids = [comments(:greetings).id, comments(:more_greetings).id] },
|
888
|
+
lambda { authors(:mary).comments = [comments(:greetings), comments(:more_greetings)] },
|
889
|
+
lambda { authors(:mary).comments << Comment.create!(:body => "Yay", :post_id => 424242) },
|
890
|
+
lambda { authors(:mary).comments.delete(authors(:mary).comments.first) },
|
891
|
+
].each {|block| assert_raise(ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection, &block) }
|
892
|
+
end
|
893
|
+
|
894
|
+
|
895
|
+
def test_assign_ids_for_through_a_belongs_to
|
896
|
+
post = Post.new(:title => "Assigning IDs works!", :body => "You heared it here first, folks!")
|
897
|
+
post.person_ids = [people(:david).id, people(:michael).id]
|
898
|
+
post.save
|
899
|
+
post.reload
|
900
|
+
assert_equal 2, post.people.length
|
901
|
+
assert post.people.include?(people(:david))
|
902
|
+
end
|
903
|
+
|
904
|
+
def test_dynamic_find_should_respect_association_order_for_through
|
905
|
+
assert_equal Comment.find(10), authors(:david).comments_desc.find(:first, :conditions => "comments.type = 'SpecialComment'")
|
906
|
+
assert_equal Comment.find(10), authors(:david).comments_desc.find_by_type('SpecialComment')
|
907
|
+
end
|
908
|
+
|
909
|
+
def test_dynamic_find_order_should_override_association_order_for_through
|
910
|
+
assert_equal Comment.find(3), authors(:david).comments_desc.find(:first, :conditions => "comments.type = 'SpecialComment'", :order => 'comments.id')
|
911
|
+
assert_equal Comment.find(3), authors(:david).comments_desc.find_by_type('SpecialComment', :order => 'comments.id')
|
912
|
+
end
|
913
|
+
|
914
|
+
def test_dynamic_find_all_should_respect_association_order_for_through
|
915
|
+
assert_equal [Comment.find(10), Comment.find(7), Comment.find(6), Comment.find(3)], authors(:david).comments_desc.find(:all, :conditions => "comments.type = 'SpecialComment'")
|
916
|
+
assert_equal [Comment.find(10), Comment.find(7), Comment.find(6), Comment.find(3)], authors(:david).comments_desc.find_all_by_type('SpecialComment')
|
917
|
+
end
|
918
|
+
|
919
|
+
def test_dynamic_find_all_order_should_override_association_order_for_through
|
920
|
+
assert_equal [Comment.find(3), Comment.find(6), Comment.find(7), Comment.find(10)], authors(:david).comments_desc.find(:all, :conditions => "comments.type = 'SpecialComment'", :order => 'comments.id')
|
921
|
+
assert_equal [Comment.find(3), Comment.find(6), Comment.find(7), Comment.find(10)], authors(:david).comments_desc.find_all_by_type('SpecialComment', :order => 'comments.id')
|
922
|
+
end
|
923
|
+
|
924
|
+
def test_dynamic_find_all_should_respect_association_limit_for_through
|
925
|
+
assert_equal 1, authors(:david).limited_comments.find(:all, :conditions => "comments.type = 'SpecialComment'").length
|
926
|
+
assert_equal 1, authors(:david).limited_comments.find_all_by_type('SpecialComment').length
|
927
|
+
end
|
928
|
+
|
929
|
+
def test_dynamic_find_all_order_should_override_association_limit_for_through
|
930
|
+
assert_equal 4, authors(:david).limited_comments.find(:all, :conditions => "comments.type = 'SpecialComment'", :limit => 9_000).length
|
931
|
+
assert_equal 4, authors(:david).limited_comments.find_all_by_type('SpecialComment', :limit => 9_000).length
|
932
|
+
end
|
933
|
+
|
934
|
+
def test_find_all_include_over_the_same_table_for_through
|
935
|
+
assert_equal 2, people(:michael).posts.find(:all, :include => :people).length
|
936
|
+
end
|
937
|
+
|
938
|
+
def test_has_many_through_respects_hash_conditions
|
939
|
+
assert_equal authors(:david).hello_posts, authors(:david).hello_posts_with_hash_conditions
|
940
|
+
assert_equal authors(:david).hello_post_comments, authors(:david).hello_post_comments_with_hash_conditions
|
941
|
+
end
|
942
|
+
|
943
|
+
def test_include_uses_array_include_after_loaded
|
944
|
+
firm = companies(:first_firm)
|
945
|
+
firm.clients.class # force load target
|
946
|
+
|
947
|
+
client = firm.clients.first
|
948
|
+
|
949
|
+
assert_no_queries do
|
950
|
+
assert firm.clients.loaded?
|
951
|
+
assert firm.clients.include?(client)
|
952
|
+
end
|
953
|
+
end
|
954
|
+
|
955
|
+
def test_include_checks_if_record_exists_if_target_not_loaded
|
956
|
+
firm = companies(:first_firm)
|
957
|
+
client = firm.clients.first
|
958
|
+
|
959
|
+
firm.reload
|
960
|
+
assert ! firm.clients.loaded?
|
961
|
+
assert_queries(1) do
|
962
|
+
assert firm.clients.include?(client)
|
963
|
+
end
|
964
|
+
assert ! firm.clients.loaded?
|
965
|
+
end
|
966
|
+
|
967
|
+
def test_include_loads_collection_if_target_uses_finder_sql
|
968
|
+
firm = companies(:first_firm)
|
969
|
+
client = firm.clients_using_sql.first
|
970
|
+
|
971
|
+
firm.reload
|
972
|
+
assert ! firm.clients_using_sql.loaded?
|
973
|
+
assert firm.clients_using_sql.include?(client)
|
974
|
+
assert firm.clients_using_sql.loaded?
|
975
|
+
end
|
976
|
+
|
977
|
+
|
978
|
+
def test_include_returns_false_for_non_matching_record_to_verify_scoping
|
979
|
+
firm = companies(:first_firm)
|
980
|
+
client = Client.create!(:name => 'Not Associated')
|
981
|
+
|
982
|
+
assert ! firm.clients.loaded?
|
983
|
+
assert ! firm.clients.include?(client)
|
984
|
+
end
|
985
|
+
|
986
|
+
def test_calling_first_or_last_on_association_should_not_load_association
|
987
|
+
firm = companies(:first_firm)
|
988
|
+
firm.clients.first
|
989
|
+
firm.clients.last
|
990
|
+
assert !firm.clients.loaded?
|
991
|
+
end
|
992
|
+
|
993
|
+
def test_calling_first_or_last_on_loaded_association_should_not_fetch_with_query
|
994
|
+
firm = companies(:first_firm)
|
995
|
+
firm.clients.class # force load target
|
996
|
+
assert firm.clients.loaded?
|
997
|
+
|
998
|
+
assert_no_queries do
|
999
|
+
firm.clients.first
|
1000
|
+
assert_equal 2, firm.clients.first(2).size
|
1001
|
+
firm.clients.last
|
1002
|
+
assert_equal 2, firm.clients.last(2).size
|
1003
|
+
end
|
1004
|
+
end
|
1005
|
+
|
1006
|
+
def test_calling_first_or_last_on_existing_record_with_build_should_load_association
|
1007
|
+
firm = companies(:first_firm)
|
1008
|
+
firm.clients.build(:name => 'Foo')
|
1009
|
+
assert !firm.clients.loaded?
|
1010
|
+
|
1011
|
+
assert_queries 1 do
|
1012
|
+
firm.clients.first
|
1013
|
+
firm.clients.last
|
1014
|
+
end
|
1015
|
+
|
1016
|
+
assert firm.clients.loaded?
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
def test_calling_first_or_last_on_existing_record_with_create_should_not_load_association
|
1020
|
+
firm = companies(:first_firm)
|
1021
|
+
firm.clients.create(:name => 'Foo')
|
1022
|
+
assert !firm.clients.loaded?
|
1023
|
+
|
1024
|
+
assert_queries 2 do
|
1025
|
+
firm.clients.first
|
1026
|
+
firm.clients.last
|
1027
|
+
end
|
1028
|
+
|
1029
|
+
assert !firm.clients.loaded?
|
1030
|
+
end
|
1031
|
+
|
1032
|
+
def test_calling_first_or_last_on_new_record_should_not_run_queries
|
1033
|
+
firm = Firm.new
|
1034
|
+
|
1035
|
+
assert_no_queries do
|
1036
|
+
firm.clients.first
|
1037
|
+
firm.clients.last
|
1038
|
+
end
|
1039
|
+
end
|
1040
|
+
|
1041
|
+
def test_calling_first_or_last_with_find_options_on_loaded_association_should_fetch_with_query
|
1042
|
+
firm = companies(:first_firm)
|
1043
|
+
firm.clients.class # force load target
|
1044
|
+
|
1045
|
+
assert_queries 2 do
|
1046
|
+
assert firm.clients.loaded?
|
1047
|
+
firm.clients.first(:order => 'name')
|
1048
|
+
firm.clients.last(:order => 'name')
|
1049
|
+
end
|
1050
|
+
end
|
1051
|
+
|
1052
|
+
def test_calling_first_or_last_with_integer_on_association_should_load_association
|
1053
|
+
firm = companies(:first_firm)
|
1054
|
+
|
1055
|
+
assert_queries 1 do
|
1056
|
+
firm.clients.first(2)
|
1057
|
+
firm.clients.last(2)
|
1058
|
+
end
|
1059
|
+
|
1060
|
+
assert firm.clients.loaded?
|
1061
|
+
end
|
1062
|
+
|
1063
|
+
def test_joins_with_namespaced_model_should_use_correct_type
|
1064
|
+
old = ActiveRecord::Base.store_full_sti_class
|
1065
|
+
ActiveRecord::Base.store_full_sti_class = true
|
1066
|
+
|
1067
|
+
firm = Namespaced::Firm.create({ :name => 'Some Company' })
|
1068
|
+
firm.clients.create({ :name => 'Some Client' })
|
1069
|
+
|
1070
|
+
stats = Namespaced::Firm.find(firm.id, {
|
1071
|
+
:select => "#{Namespaced::Firm.table_name}.id, COUNT(#{Namespaced::Client.table_name}.id) AS num_clients",
|
1072
|
+
:joins => :clients,
|
1073
|
+
:group => "#{Namespaced::Firm.table_name}.id"
|
1074
|
+
})
|
1075
|
+
assert_equal 1, stats.num_clients.to_i
|
1076
|
+
|
1077
|
+
ensure
|
1078
|
+
ActiveRecord::Base.store_full_sti_class = old
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
uses_mocha 'mocking Comment.transaction' do
|
1082
|
+
def test_association_proxy_transaction_method_starts_transaction_in_association_class
|
1083
|
+
Comment.expects(:transaction)
|
1084
|
+
Post.find(:first).comments.transaction do
|
1085
|
+
# nothing
|
1086
|
+
end
|
1087
|
+
end
|
1088
|
+
end
|
1089
|
+
|
1090
|
+
def test_sending_new_to_association_proxy_should_have_same_effect_as_calling_new
|
1091
|
+
client_association = companies(:first_firm).clients
|
1092
|
+
assert_equal client_association.new.attributes, client_association.send(:new).attributes
|
1093
|
+
end
|
1094
|
+
|
1095
|
+
def test_respond_to_private_class_methods
|
1096
|
+
client_association = companies(:first_firm).clients
|
1097
|
+
assert !client_association.respond_to?(:private_method)
|
1098
|
+
assert client_association.respond_to?(:private_method, true)
|
1099
|
+
end
|
1100
|
+
end
|
1101
|
+
|