activerecord 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- data/CHANGELOG +4928 -3
 - data/README +45 -46
 - data/RUNNING_UNIT_TESTS +8 -11
 - data/Rakefile +247 -0
 - data/install.rb +8 -38
 - data/lib/active_record/aggregations.rb +64 -49
 - data/lib/active_record/associations/association_collection.rb +217 -47
 - data/lib/active_record/associations/association_proxy.rb +159 -0
 - data/lib/active_record/associations/belongs_to_association.rb +56 -0
 - data/lib/active_record/associations/belongs_to_polymorphic_association.rb +50 -0
 - data/lib/active_record/associations/has_and_belongs_to_many_association.rb +155 -37
 - data/lib/active_record/associations/has_many_association.rb +145 -75
 - data/lib/active_record/associations/has_many_through_association.rb +283 -0
 - data/lib/active_record/associations/has_one_association.rb +96 -0
 - data/lib/active_record/associations.rb +1537 -304
 - data/lib/active_record/attribute_methods.rb +328 -0
 - data/lib/active_record/base.rb +2001 -588
 - data/lib/active_record/calculations.rb +269 -0
 - data/lib/active_record/callbacks.rb +169 -165
 - data/lib/active_record/connection_adapters/abstract/connection_specification.rb +308 -0
 - data/lib/active_record/connection_adapters/abstract/database_statements.rb +171 -0
 - data/lib/active_record/connection_adapters/abstract/query_cache.rb +87 -0
 - data/lib/active_record/connection_adapters/abstract/quoting.rb +69 -0
 - data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +472 -0
 - data/lib/active_record/connection_adapters/abstract/schema_statements.rb +306 -0
 - data/lib/active_record/connection_adapters/abstract_adapter.rb +125 -279
 - data/lib/active_record/connection_adapters/mysql_adapter.rb +442 -77
 - data/lib/active_record/connection_adapters/postgresql_adapter.rb +805 -135
 - data/lib/active_record/connection_adapters/sqlite3_adapter.rb +34 -0
 - data/lib/active_record/connection_adapters/sqlite_adapter.rb +353 -69
 - data/lib/active_record/fixtures.rb +946 -100
 - data/lib/active_record/locking/optimistic.rb +144 -0
 - data/lib/active_record/locking/pessimistic.rb +77 -0
 - data/lib/active_record/migration.rb +417 -0
 - data/lib/active_record/observer.rb +142 -32
 - data/lib/active_record/query_cache.rb +23 -0
 - data/lib/active_record/reflection.rb +163 -70
 - data/lib/active_record/schema.rb +58 -0
 - data/lib/active_record/schema_dumper.rb +171 -0
 - data/lib/active_record/serialization.rb +98 -0
 - data/lib/active_record/serializers/json_serializer.rb +71 -0
 - data/lib/active_record/serializers/xml_serializer.rb +315 -0
 - data/lib/active_record/timestamp.rb +41 -0
 - data/lib/active_record/transactions.rb +87 -57
 - data/lib/active_record/validations.rb +909 -122
 - data/lib/active_record/vendor/db2.rb +362 -0
 - data/lib/active_record/vendor/mysql.rb +126 -29
 - data/lib/active_record/version.rb +9 -0
 - data/lib/active_record.rb +35 -7
 - data/lib/activerecord.rb +1 -0
 - data/test/aaa_create_tables_test.rb +72 -0
 - data/test/abstract_unit.rb +73 -5
 - data/test/active_schema_test_mysql.rb +43 -0
 - data/test/adapter_test.rb +105 -0
 - data/test/adapter_test_sqlserver.rb +95 -0
 - data/test/aggregations_test.rb +110 -16
 - data/test/all.sh +2 -2
 - data/test/ar_schema_test.rb +33 -0
 - data/test/association_inheritance_reload.rb +14 -0
 - data/test/associations/ar_joins_test.rb +0 -0
 - data/test/associations/callbacks_test.rb +147 -0
 - data/test/associations/cascaded_eager_loading_test.rb +110 -0
 - data/test/associations/eager_singularization_test.rb +145 -0
 - data/test/associations/eager_test.rb +442 -0
 - data/test/associations/extension_test.rb +47 -0
 - data/test/associations/inner_join_association_test.rb +88 -0
 - data/test/associations/join_model_test.rb +553 -0
 - data/test/associations_test.rb +1930 -267
 - data/test/attribute_methods_test.rb +146 -0
 - data/test/base_test.rb +1316 -84
 - data/test/binary_test.rb +32 -0
 - data/test/calculations_test.rb +251 -0
 - data/test/callbacks_test.rb +400 -0
 - data/test/class_inheritable_attributes_test.rb +3 -4
 - data/test/column_alias_test.rb +17 -0
 - data/test/connection_test_firebird.rb +8 -0
 - data/test/connection_test_mysql.rb +30 -0
 - data/test/connections/native_db2/connection.rb +25 -0
 - data/test/connections/native_firebird/connection.rb +26 -0
 - data/test/connections/native_frontbase/connection.rb +27 -0
 - data/test/connections/native_mysql/connection.rb +21 -18
 - data/test/connections/native_openbase/connection.rb +21 -0
 - data/test/connections/native_oracle/connection.rb +27 -0
 - data/test/connections/native_postgresql/connection.rb +17 -18
 - data/test/connections/native_sqlite/connection.rb +17 -16
 - data/test/connections/native_sqlite3/connection.rb +25 -0
 - data/test/connections/native_sqlite3/in_memory_connection.rb +18 -0
 - data/test/connections/native_sybase/connection.rb +23 -0
 - data/test/copy_table_test_sqlite.rb +69 -0
 - data/test/datatype_test_postgresql.rb +203 -0
 - data/test/date_time_test.rb +37 -0
 - data/test/default_test_firebird.rb +16 -0
 - data/test/defaults_test.rb +67 -0
 - data/test/deprecated_finder_test.rb +30 -0
 - data/test/finder_test.rb +607 -32
 - data/test/fixtures/accounts.yml +28 -0
 - data/test/fixtures/all/developers.yml +0 -0
 - data/test/fixtures/all/people.csv +0 -0
 - data/test/fixtures/all/tasks.yml +0 -0
 - data/test/fixtures/author.rb +107 -0
 - data/test/fixtures/author_favorites.yml +4 -0
 - data/test/fixtures/authors.yml +7 -0
 - data/test/fixtures/bad_fixtures/attr_with_numeric_first_char +1 -0
 - data/test/fixtures/bad_fixtures/attr_with_spaces +1 -0
 - data/test/fixtures/bad_fixtures/blank_line +3 -0
 - data/test/fixtures/bad_fixtures/duplicate_attributes +3 -0
 - data/test/fixtures/bad_fixtures/missing_value +1 -0
 - data/test/fixtures/binaries.yml +132 -0
 - data/test/fixtures/binary.rb +2 -0
 - data/test/fixtures/book.rb +4 -0
 - data/test/fixtures/books.yml +7 -0
 - data/test/fixtures/categories/special_categories.yml +9 -0
 - data/test/fixtures/categories/subsubdir/arbitrary_filename.yml +4 -0
 - data/test/fixtures/categories.yml +14 -0
 - data/test/fixtures/categories_ordered.yml +7 -0
 - data/test/fixtures/categories_posts.yml +23 -0
 - data/test/fixtures/categorization.rb +5 -0
 - data/test/fixtures/categorizations.yml +17 -0
 - data/test/fixtures/category.rb +26 -0
 - data/test/fixtures/citation.rb +6 -0
 - data/test/fixtures/comment.rb +23 -0
 - data/test/fixtures/comments.yml +59 -0
 - data/test/fixtures/companies.yml +55 -0
 - data/test/fixtures/company.rb +81 -4
 - data/test/fixtures/company_in_module.rb +32 -6
 - data/test/fixtures/computer.rb +4 -0
 - data/test/fixtures/computers.yml +4 -0
 - data/test/fixtures/contact.rb +16 -0
 - data/test/fixtures/courses.yml +7 -0
 - data/test/fixtures/customer.rb +28 -3
 - data/test/fixtures/customers.yml +17 -0
 - data/test/fixtures/db_definitions/db2.drop.sql +33 -0
 - data/test/fixtures/db_definitions/db2.sql +235 -0
 - data/test/fixtures/db_definitions/db22.drop.sql +2 -0
 - data/test/fixtures/db_definitions/db22.sql +5 -0
 - data/test/fixtures/db_definitions/firebird.drop.sql +65 -0
 - data/test/fixtures/db_definitions/firebird.sql +310 -0
 - data/test/fixtures/db_definitions/firebird2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/firebird2.sql +6 -0
 - data/test/fixtures/db_definitions/frontbase.drop.sql +33 -0
 - data/test/fixtures/db_definitions/frontbase.sql +273 -0
 - data/test/fixtures/db_definitions/frontbase2.drop.sql +1 -0
 - data/test/fixtures/db_definitions/frontbase2.sql +4 -0
 - data/test/fixtures/db_definitions/openbase.drop.sql +2 -0
 - data/test/fixtures/db_definitions/openbase.sql +318 -0
 - data/test/fixtures/db_definitions/openbase2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/openbase2.sql +7 -0
 - data/test/fixtures/db_definitions/oracle.drop.sql +67 -0
 - data/test/fixtures/db_definitions/oracle.sql +330 -0
 - data/test/fixtures/db_definitions/oracle2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/oracle2.sql +6 -0
 - data/test/fixtures/db_definitions/postgresql.drop.sql +44 -0
 - data/test/fixtures/db_definitions/postgresql.sql +217 -38
 - data/test/fixtures/db_definitions/postgresql2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/postgresql2.sql +2 -2
 - data/test/fixtures/db_definitions/schema.rb +354 -0
 - data/test/fixtures/db_definitions/schema2.rb +11 -0
 - data/test/fixtures/db_definitions/sqlite.drop.sql +33 -0
 - data/test/fixtures/db_definitions/sqlite.sql +139 -5
 - data/test/fixtures/db_definitions/sqlite2.drop.sql +2 -0
 - data/test/fixtures/db_definitions/sqlite2.sql +1 -0
 - data/test/fixtures/db_definitions/sybase.drop.sql +35 -0
 - data/test/fixtures/db_definitions/sybase.sql +222 -0
 - data/test/fixtures/db_definitions/sybase2.drop.sql +4 -0
 - data/test/fixtures/db_definitions/sybase2.sql +5 -0
 - data/test/fixtures/developer.rb +70 -6
 - data/test/fixtures/developers.yml +21 -0
 - data/test/fixtures/developers_projects/david_action_controller +2 -1
 - data/test/fixtures/developers_projects/david_active_record +2 -1
 - data/test/fixtures/developers_projects.yml +17 -0
 - data/test/fixtures/edge.rb +5 -0
 - data/test/fixtures/edges.yml +6 -0
 - data/test/fixtures/entrants.yml +14 -0
 - data/test/fixtures/example.log +1 -0
 - data/test/fixtures/fk_test_has_fk.yml +3 -0
 - data/test/fixtures/fk_test_has_pk.yml +2 -0
 - data/test/fixtures/flowers.jpg +0 -0
 - data/test/fixtures/funny_jokes.yml +10 -0
 - data/test/fixtures/item.rb +7 -0
 - data/test/fixtures/items.yml +4 -0
 - data/test/fixtures/joke.rb +3 -0
 - data/test/fixtures/keyboard.rb +3 -0
 - data/test/fixtures/legacy_thing.rb +3 -0
 - data/test/fixtures/legacy_things.yml +3 -0
 - data/test/fixtures/matey.rb +4 -0
 - data/test/fixtures/mateys.yml +4 -0
 - data/test/fixtures/migrations/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations/2_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations/3_innocent_jointable.rb +12 -0
 - data/test/fixtures/migrations_with_decimal/1_give_me_big_numbers.rb +15 -0
 - data/test/fixtures/migrations_with_duplicate/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations_with_duplicate/2_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations_with_duplicate/3_foo.rb +7 -0
 - data/test/fixtures/migrations_with_duplicate/3_innocent_jointable.rb +12 -0
 - data/test/fixtures/migrations_with_missing_versions/1000_people_have_middle_names.rb +9 -0
 - data/test/fixtures/migrations_with_missing_versions/1_people_have_last_names.rb +9 -0
 - data/test/fixtures/migrations_with_missing_versions/3_we_need_reminders.rb +12 -0
 - data/test/fixtures/migrations_with_missing_versions/4_innocent_jointable.rb +12 -0
 - data/test/fixtures/minimalistic.rb +2 -0
 - data/test/fixtures/minimalistics.yml +2 -0
 - data/test/fixtures/mixed_case_monkey.rb +3 -0
 - data/test/fixtures/mixed_case_monkeys.yml +6 -0
 - data/test/fixtures/mixins.yml +29 -0
 - data/test/fixtures/movies.yml +7 -0
 - data/test/fixtures/naked/csv/accounts.csv +1 -0
 - data/test/fixtures/naked/yml/accounts.yml +1 -0
 - data/test/fixtures/naked/yml/companies.yml +1 -0
 - data/test/fixtures/naked/yml/courses.yml +1 -0
 - data/test/fixtures/order.rb +4 -0
 - data/test/fixtures/parrot.rb +13 -0
 - data/test/fixtures/parrots.yml +27 -0
 - data/test/fixtures/parrots_pirates.yml +7 -0
 - data/test/fixtures/people.yml +3 -0
 - data/test/fixtures/person.rb +4 -0
 - data/test/fixtures/pirate.rb +5 -0
 - data/test/fixtures/pirates.yml +9 -0
 - data/test/fixtures/post.rb +59 -0
 - data/test/fixtures/posts.yml +48 -0
 - data/test/fixtures/project.rb +27 -2
 - data/test/fixtures/projects.yml +7 -0
 - data/test/fixtures/reader.rb +4 -0
 - data/test/fixtures/readers.yml +4 -0
 - data/test/fixtures/reply.rb +18 -2
 - data/test/fixtures/reserved_words/distinct.yml +5 -0
 - data/test/fixtures/reserved_words/distincts_selects.yml +11 -0
 - data/test/fixtures/reserved_words/group.yml +14 -0
 - data/test/fixtures/reserved_words/select.yml +8 -0
 - data/test/fixtures/reserved_words/values.yml +7 -0
 - data/test/fixtures/ship.rb +3 -0
 - data/test/fixtures/ships.yml +5 -0
 - data/test/fixtures/subject.rb +4 -0
 - data/test/fixtures/subscriber.rb +4 -3
 - data/test/fixtures/tag.rb +7 -0
 - data/test/fixtures/tagging.rb +10 -0
 - data/test/fixtures/taggings.yml +25 -0
 - data/test/fixtures/tags.yml +7 -0
 - data/test/fixtures/task.rb +3 -0
 - data/test/fixtures/tasks.yml +7 -0
 - data/test/fixtures/topic.rb +20 -3
 - data/test/fixtures/topics.yml +22 -0
 - data/test/fixtures/treasure.rb +4 -0
 - data/test/fixtures/treasures.yml +10 -0
 - data/test/fixtures/vertex.rb +9 -0
 - data/test/fixtures/vertices.yml +4 -0
 - data/test/fixtures_test.rb +574 -8
 - data/test/inheritance_test.rb +113 -27
 - data/test/json_serialization_test.rb +180 -0
 - data/test/lifecycle_test.rb +56 -29
 - data/test/locking_test.rb +273 -0
 - data/test/method_scoping_test.rb +416 -0
 - data/test/migration_test.rb +933 -0
 - data/test/migration_test_firebird.rb +124 -0
 - data/test/mixin_test.rb +95 -0
 - data/test/modules_test.rb +23 -10
 - data/test/multiple_db_test.rb +17 -3
 - data/test/pk_test.rb +59 -15
 - data/test/query_cache_test.rb +104 -0
 - data/test/readonly_test.rb +107 -0
 - data/test/reflection_test.rb +124 -27
 - data/test/reserved_word_test_mysql.rb +177 -0
 - data/test/schema_authorization_test_postgresql.rb +75 -0
 - data/test/schema_dumper_test.rb +131 -0
 - data/test/schema_test_postgresql.rb +64 -0
 - data/test/serialization_test.rb +47 -0
 - data/test/synonym_test_oracle.rb +17 -0
 - data/test/table_name_test_sqlserver.rb +23 -0
 - data/test/threaded_connections_test.rb +48 -0
 - data/test/transactions_test.rb +227 -29
 - data/test/unconnected_test.rb +14 -6
 - data/test/validations_test.rb +1293 -32
 - data/test/xml_serialization_test.rb +202 -0
 - metadata +347 -143
 - data/dev-utils/eval_debugger.rb +0 -9
 - data/examples/associations.rb +0 -87
 - data/examples/shared_setup.rb +0 -15
 - data/examples/validation.rb +0 -88
 - data/lib/active_record/deprecated_associations.rb +0 -70
 - data/lib/active_record/support/class_attribute_accessors.rb +0 -43
 - data/lib/active_record/support/class_inheritable_attributes.rb +0 -37
 - data/lib/active_record/support/clean_logger.rb +0 -10
 - data/lib/active_record/support/inflector.rb +0 -70
 - data/lib/active_record/vendor/simple.rb +0 -702
 - data/lib/active_record/wrappers/yaml_wrapper.rb +0 -15
 - data/lib/active_record/wrappings.rb +0 -59
 - data/rakefile +0 -122
 - data/test/deprecated_associations_test.rb +0 -336
 - data/test/fixtures/accounts/signals37 +0 -3
 - data/test/fixtures/accounts/unknown +0 -2
 - data/test/fixtures/companies/first_client +0 -6
 - data/test/fixtures/companies/first_firm +0 -4
 - data/test/fixtures/companies/second_client +0 -6
 - data/test/fixtures/courses/java +0 -2
 - data/test/fixtures/courses/ruby +0 -2
 - data/test/fixtures/customers/david +0 -6
 - data/test/fixtures/db_definitions/mysql.sql +0 -96
 - data/test/fixtures/db_definitions/mysql2.sql +0 -4
 - data/test/fixtures/developers/david +0 -2
 - data/test/fixtures/developers/jamis +0 -2
 - data/test/fixtures/entrants/first +0 -3
 - data/test/fixtures/entrants/second +0 -3
 - data/test/fixtures/entrants/third +0 -3
 - data/test/fixtures/fixture_database.sqlite +0 -0
 - data/test/fixtures/fixture_database_2.sqlite +0 -0
 - data/test/fixtures/movies/first +0 -2
 - data/test/fixtures/movies/second +0 -2
 - data/test/fixtures/projects/action_controller +0 -2
 - data/test/fixtures/projects/active_record +0 -2
 - data/test/fixtures/topics/first +0 -9
 - data/test/fixtures/topics/second +0 -8
 - data/test/inflector_test.rb +0 -104
 - data/test/thread_safety_test.rb +0 -33
 
| 
         @@ -0,0 +1,17 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'abstract_unit'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'fixtures/topic'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            class TestColumnAlias < Test::Unit::TestCase
         
     | 
| 
      
 5 
     | 
    
         
            +
              fixtures :topics
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
              QUERY = if 'Oracle' == ActiveRecord::Base.connection.adapter_name
         
     | 
| 
      
 8 
     | 
    
         
            +
                        'SELECT id AS pk FROM topics WHERE ROWNUM < 2'
         
     | 
| 
      
 9 
     | 
    
         
            +
                      else
         
     | 
| 
      
 10 
     | 
    
         
            +
                        'SELECT id AS pk FROM topics'
         
     | 
| 
      
 11 
     | 
    
         
            +
                      end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              def test_column_alias
         
     | 
| 
      
 14 
     | 
    
         
            +
                records = Topic.connection.select_all(QUERY)
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_equal 'pk', records[0].keys[0]
         
     | 
| 
      
 16 
     | 
    
         
            +
              end
         
     | 
| 
      
 17 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,8 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "#{File.dirname(__FILE__)}/abstract_unit"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class FirebirdConnectionTest < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def test_charset_properly_set
         
     | 
| 
      
 5 
     | 
    
         
            +
                fb_conn = ActiveRecord::Base.connection.instance_variable_get(:@connection)
         
     | 
| 
      
 6 
     | 
    
         
            +
                assert_equal 'UTF8', fb_conn.database.character_set
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "#{File.dirname(__FILE__)}/abstract_unit"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class MysqlConnectionTest < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 5 
     | 
    
         
            +
                @connection = ActiveRecord::Base.connection
         
     | 
| 
      
 6 
     | 
    
         
            +
              end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
              def test_no_automatic_reconnection_after_timeout
         
     | 
| 
      
 9 
     | 
    
         
            +
                assert @connection.active?
         
     | 
| 
      
 10 
     | 
    
         
            +
                @connection.update('set @@wait_timeout=1')
         
     | 
| 
      
 11 
     | 
    
         
            +
                sleep 2
         
     | 
| 
      
 12 
     | 
    
         
            +
                assert !@connection.active?
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
              def test_successful_reconnection_after_timeout_with_manual_reconnect
         
     | 
| 
      
 16 
     | 
    
         
            +
                assert @connection.active?
         
     | 
| 
      
 17 
     | 
    
         
            +
                @connection.update('set @@wait_timeout=1')
         
     | 
| 
      
 18 
     | 
    
         
            +
                sleep 2
         
     | 
| 
      
 19 
     | 
    
         
            +
                @connection.reconnect!
         
     | 
| 
      
 20 
     | 
    
         
            +
                assert @connection.active?
         
     | 
| 
      
 21 
     | 
    
         
            +
              end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              def test_successful_reconnection_after_timeout_with_verify
         
     | 
| 
      
 24 
     | 
    
         
            +
                assert @connection.active?
         
     | 
| 
      
 25 
     | 
    
         
            +
                @connection.update('set @@wait_timeout=1')
         
     | 
| 
      
 26 
     | 
    
         
            +
                sleep 2
         
     | 
| 
      
 27 
     | 
    
         
            +
                @connection.verify!(0)
         
     | 
| 
      
 28 
     | 
    
         
            +
                assert @connection.active?
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native DB2\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter => 'db2',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :username => 'arunit',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :password => 'arunit',
         
     | 
| 
      
 13 
     | 
    
         
            +
                :database => 'arunit'
         
     | 
| 
      
 14 
     | 
    
         
            +
              },
         
     | 
| 
      
 15 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 16 
     | 
    
         
            +
                :adapter => 'db2',
         
     | 
| 
      
 17 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 18 
     | 
    
         
            +
                :username => 'arunit',
         
     | 
| 
      
 19 
     | 
    
         
            +
                :password => 'arunit',
         
     | 
| 
      
 20 
     | 
    
         
            +
                :database => 'arunit2'
         
     | 
| 
      
 21 
     | 
    
         
            +
              }
         
     | 
| 
      
 22 
     | 
    
         
            +
            }
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 25 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native Firebird\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter => 'firebird',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :password => 'rails',
         
     | 
| 
      
 13 
     | 
    
         
            +
                :database => 'activerecord_unittest',
         
     | 
| 
      
 14 
     | 
    
         
            +
                :charset => 'UTF8'
         
     | 
| 
      
 15 
     | 
    
         
            +
              },
         
     | 
| 
      
 16 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 17 
     | 
    
         
            +
                :adapter => 'firebird',
         
     | 
| 
      
 18 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 19 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 20 
     | 
    
         
            +
                :password => 'rails',
         
     | 
| 
      
 21 
     | 
    
         
            +
                :database => 'activerecord_unittest2'
         
     | 
| 
      
 22 
     | 
    
         
            +
              }
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 26 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            puts 'Using native Frontbase'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter => 'frontbase',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :password => '',
         
     | 
| 
      
 13 
     | 
    
         
            +
                :database => 'activerecord_unittest',
         
     | 
| 
      
 14 
     | 
    
         
            +
                :session_name => "unittest-#{$$}"
         
     | 
| 
      
 15 
     | 
    
         
            +
              },
         
     | 
| 
      
 16 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 17 
     | 
    
         
            +
                :adapter => 'frontbase',
         
     | 
| 
      
 18 
     | 
    
         
            +
                :host => 'localhost',
         
     | 
| 
      
 19 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 20 
     | 
    
         
            +
                :password => '',
         
     | 
| 
      
 21 
     | 
    
         
            +
                :database => 'activerecord_unittest2',
         
     | 
| 
      
 22 
     | 
    
         
            +
                :session_name => "unittest-#{$$}"
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
            }
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 27 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -1,24 +1,27 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            print "Using native MySQL\n"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'logger'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 5 
     | 
    
         
            +
            RAILS_DEFAULT_LOGGER = Logger.new('debug.log')
         
     | 
| 
      
 6 
     | 
    
         
            +
            RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
         
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.logger = RAILS_DEFAULT_LOGGER
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 9 
     | 
    
         
            +
            # GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost';
         
     | 
| 
      
 10 
     | 
    
         
            +
            # GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost';
         
     | 
| 
       9 
11 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            ActiveRecord::Base. 
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
               
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
      
 12 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 13 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 14 
     | 
    
         
            +
                :adapter  => 'mysql',
         
     | 
| 
      
 15 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 16 
     | 
    
         
            +
                :encoding => 'utf8',
         
     | 
| 
      
 17 
     | 
    
         
            +
                :database => 'activerecord_unittest',
         
     | 
| 
      
 18 
     | 
    
         
            +
              },
         
     | 
| 
      
 19 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 20 
     | 
    
         
            +
                :adapter  => 'mysql',
         
     | 
| 
      
 21 
     | 
    
         
            +
                :username => 'rails',
         
     | 
| 
      
 22 
     | 
    
         
            +
                :database => 'activerecord_unittest2'
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
            }
         
     | 
| 
       17 
25 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
              :host     => "localhost",
         
     | 
| 
       21 
     | 
    
         
            -
              :username => "root",
         
     | 
| 
       22 
     | 
    
         
            -
              :password => "",
         
     | 
| 
       23 
     | 
    
         
            -
              :database => db2
         
     | 
| 
       24 
     | 
    
         
            -
            )
         
     | 
| 
      
 26 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 27 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native OpenBase\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter  => 'openbase',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :username => 'admin',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :database => 'activerecord_unittest',
         
     | 
| 
      
 12 
     | 
    
         
            +
              },
         
     | 
| 
      
 13 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 14 
     | 
    
         
            +
                :adapter  => 'openbase',
         
     | 
| 
      
 15 
     | 
    
         
            +
                :username => 'admin',
         
     | 
| 
      
 16 
     | 
    
         
            +
                :database => 'activerecord_unittest2'
         
     | 
| 
      
 17 
     | 
    
         
            +
              }
         
     | 
| 
      
 18 
     | 
    
         
            +
            }
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 21 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using Oracle\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new STDOUT
         
     | 
| 
      
 6 
     | 
    
         
            +
            ActiveRecord::Base.logger.level = Logger::WARN
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            # Set these to your database connection strings
         
     | 
| 
      
 9 
     | 
    
         
            +
            db = ENV['ARUNIT_DB'] || 'activerecord_unittest'
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 12 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 13 
     | 
    
         
            +
                :adapter  => 'oracle',
         
     | 
| 
      
 14 
     | 
    
         
            +
                :username => 'arunit',
         
     | 
| 
      
 15 
     | 
    
         
            +
                :password => 'arunit',
         
     | 
| 
      
 16 
     | 
    
         
            +
                :database => db,
         
     | 
| 
      
 17 
     | 
    
         
            +
              },
         
     | 
| 
      
 18 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 19 
     | 
    
         
            +
                :adapter  => 'oracle',
         
     | 
| 
      
 20 
     | 
    
         
            +
                :username => 'arunit2',
         
     | 
| 
      
 21 
     | 
    
         
            +
                :password => 'arunit2',
         
     | 
| 
      
 22 
     | 
    
         
            +
                :database => db
         
     | 
| 
      
 23 
     | 
    
         
            +
              }
         
     | 
| 
      
 24 
     | 
    
         
            +
            }
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 27 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -1,24 +1,23 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            print "Using native PostgreSQL\n"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'logger'
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter  => 'postgresql',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :username => 'postgres',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :database => 'activerecord_unittest',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :min_messages => 'warning'
         
     | 
| 
      
 13 
     | 
    
         
            +
              },
         
     | 
| 
      
 14 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 15 
     | 
    
         
            +
                :adapter  => 'postgresql',
         
     | 
| 
      
 16 
     | 
    
         
            +
                :username => 'postgres',
         
     | 
| 
      
 17 
     | 
    
         
            +
                :database => 'activerecord_unittest2',
         
     | 
| 
      
 18 
     | 
    
         
            +
                :min_messages => 'warning'
         
     | 
| 
      
 19 
     | 
    
         
            +
              }
         
     | 
| 
      
 20 
     | 
    
         
            +
            }
         
     | 
| 
       9 
21 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
            ActiveRecord::Base.establish_connection 
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
              :host     => nil, 
         
     | 
| 
       13 
     | 
    
         
            -
              :username => "postgres",
         
     | 
| 
       14 
     | 
    
         
            -
              :password => "postgres", 
         
     | 
| 
       15 
     | 
    
         
            -
              :database => db1
         
     | 
| 
       16 
     | 
    
         
            -
            )
         
     | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
       18 
     | 
    
         
            -
            Course.establish_connection(
         
     | 
| 
       19 
     | 
    
         
            -
              :adapter  => "postgresql",
         
     | 
| 
       20 
     | 
    
         
            -
              :host     => nil, 
         
     | 
| 
       21 
     | 
    
         
            -
              :username => "postgres",
         
     | 
| 
       22 
     | 
    
         
            -
              :password => "postgres", 
         
     | 
| 
       23 
     | 
    
         
            -
              :database => db2
         
     | 
| 
       24 
     | 
    
         
            -
            )
         
     | 
| 
      
 22 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 23 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -1,24 +1,25 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            print "Using native SQlite\n"
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'logger'
         
     | 
| 
       4 
4 
     | 
    
         
             
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
      
 6 
     | 
    
         
            +
            class SqliteError < StandardError
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
         
     | 
| 
      
 10 
     | 
    
         
            +
            sqlite_test_db  = "#{BASE_DIR}/fixture_database.sqlite"
         
     | 
| 
      
 11 
     | 
    
         
            +
            sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite"
         
     | 
| 
       9 
12 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
               
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                 
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
                puts " 
     | 
| 
      
 13 
     | 
    
         
            +
            def make_connection(clazz, db_file)
         
     | 
| 
      
 14 
     | 
    
         
            +
              ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite', :database => db_file } }
         
     | 
| 
      
 15 
     | 
    
         
            +
              unless File.exist?(db_file)
         
     | 
| 
      
 16 
     | 
    
         
            +
                puts "SQLite database not found at #{db_file}. Rebuilding it."
         
     | 
| 
      
 17 
     | 
    
         
            +
                sqlite_command = %Q{sqlite "#{db_file}" "create table a (a integer); drop table a;"}
         
     | 
| 
      
 18 
     | 
    
         
            +
                puts "Executing '#{sqlite_command}'"
         
     | 
| 
      
 19 
     | 
    
         
            +
                raise SqliteError.new("Seems that there is no sqlite executable available") unless system(sqlite_command)
         
     | 
| 
       16 
20 
     | 
    
         
             
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
              clazz.establish_connection(clazz.name)
         
     | 
| 
       17 
22 
     | 
    
         
             
            end
         
     | 
| 
       18 
23 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
            ActiveRecord::Base 
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
              :dbfile  => sqlite_test_db)
         
     | 
| 
       22 
     | 
    
         
            -
            Course.establish_connection(
         
     | 
| 
       23 
     | 
    
         
            -
              :adapter => "sqlite",
         
     | 
| 
       24 
     | 
    
         
            -
              :dbfile  => sqlite_test_db2)
         
     | 
| 
      
 24 
     | 
    
         
            +
            make_connection(ActiveRecord::Base, sqlite_test_db)
         
     | 
| 
      
 25 
     | 
    
         
            +
            make_connection(Course, sqlite_test_db2)
         
     | 
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native SQLite3\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class SqliteError < StandardError
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            BASE_DIR = File.expand_path(File.dirname(__FILE__) + '/../../fixtures')
         
     | 
| 
      
 10 
     | 
    
         
            +
            sqlite_test_db  = "#{BASE_DIR}/fixture_database.sqlite3"
         
     | 
| 
      
 11 
     | 
    
         
            +
            sqlite_test_db2 = "#{BASE_DIR}/fixture_database_2.sqlite3"
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            def make_connection(clazz, db_file)
         
     | 
| 
      
 14 
     | 
    
         
            +
              ActiveRecord::Base.configurations = { clazz.name => { :adapter => 'sqlite3', :database => db_file, :timeout => 5000 } }
         
     | 
| 
      
 15 
     | 
    
         
            +
              unless File.exist?(db_file)
         
     | 
| 
      
 16 
     | 
    
         
            +
                puts "SQLite3 database not found at #{db_file}. Rebuilding it."
         
     | 
| 
      
 17 
     | 
    
         
            +
                sqlite_command = %Q{sqlite3 "#{db_file}" "create table a (a integer); drop table a;"}
         
     | 
| 
      
 18 
     | 
    
         
            +
                puts "Executing '#{sqlite_command}'"
         
     | 
| 
      
 19 
     | 
    
         
            +
                raise SqliteError.new("Seems that there is no sqlite3 executable available") unless system(sqlite_command)
         
     | 
| 
      
 20 
     | 
    
         
            +
              end
         
     | 
| 
      
 21 
     | 
    
         
            +
              clazz.establish_connection(clazz.name)
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            make_connection(ActiveRecord::Base, sqlite_test_db)
         
     | 
| 
      
 25 
     | 
    
         
            +
            make_connection(Course, sqlite_test_db2)
         
     | 
| 
         @@ -0,0 +1,18 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native SQLite3\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class SqliteError < StandardError
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            def make_connection(clazz, db_definitions_file)
         
     | 
| 
      
 10 
     | 
    
         
            +
              clazz.establish_connection(:adapter => 'sqlite3', :database  => ':memory:')
         
     | 
| 
      
 11 
     | 
    
         
            +
              File.read("#{File.dirname(__FILE__)}/../../fixtures/db_definitions/#{db_definitions_file}").split(';').each do |command|
         
     | 
| 
      
 12 
     | 
    
         
            +
                clazz.connection.execute(command) unless command.strip.empty?
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            make_connection(ActiveRecord::Base, 'sqlite.sql')
         
     | 
| 
      
 17 
     | 
    
         
            +
            make_connection(Course, 'sqlite2.sql')
         
     | 
| 
      
 18 
     | 
    
         
            +
            load("#{File.dirname(__FILE__)}/../../fixtures/db_definitions/schema.rb")
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            print "Using native Sybase Open Client\n"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_dependency 'fixtures/course'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'logger'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            ActiveRecord::Base.logger = Logger.new("debug.log")
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            ActiveRecord::Base.configurations = {
         
     | 
| 
      
 8 
     | 
    
         
            +
              'arunit' => {
         
     | 
| 
      
 9 
     | 
    
         
            +
                :adapter  => 'sybase',
         
     | 
| 
      
 10 
     | 
    
         
            +
                :host     => 'database_ASE',
         
     | 
| 
      
 11 
     | 
    
         
            +
                :username => 'sa',
         
     | 
| 
      
 12 
     | 
    
         
            +
                :database => 'activerecord_unittest'
         
     | 
| 
      
 13 
     | 
    
         
            +
              },
         
     | 
| 
      
 14 
     | 
    
         
            +
              'arunit2' => {
         
     | 
| 
      
 15 
     | 
    
         
            +
                :adapter  => 'sybase',
         
     | 
| 
      
 16 
     | 
    
         
            +
                :host     => 'database_ASE',
         
     | 
| 
      
 17 
     | 
    
         
            +
                :username => 'sa',
         
     | 
| 
      
 18 
     | 
    
         
            +
                :database => 'activerecord_unittest2'
         
     | 
| 
      
 19 
     | 
    
         
            +
              }
         
     | 
| 
      
 20 
     | 
    
         
            +
            }
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ActiveRecord::Base.establish_connection 'arunit'
         
     | 
| 
      
 23 
     | 
    
         
            +
            Course.establish_connection 'arunit2'
         
     | 
| 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'abstract_unit'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class CopyTableTest < Test::Unit::TestCase
         
     | 
| 
      
 4 
     | 
    
         
            +
              fixtures :companies, :comments
         
     | 
| 
      
 5 
     | 
    
         
            +
              
         
     | 
| 
      
 6 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 7 
     | 
    
         
            +
                @connection = ActiveRecord::Base.connection
         
     | 
| 
      
 8 
     | 
    
         
            +
                class << @connection
         
     | 
| 
      
 9 
     | 
    
         
            +
                  public :copy_table, :table_structure, :indexes
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
              end
         
     | 
| 
      
 12 
     | 
    
         
            +
              
         
     | 
| 
      
 13 
     | 
    
         
            +
              def test_copy_table(from = 'companies', to = 'companies2', options = {})
         
     | 
| 
      
 14 
     | 
    
         
            +
                assert_nothing_raised {copy_table(from, to, options)}
         
     | 
| 
      
 15 
     | 
    
         
            +
                assert_equal row_count(from), row_count(to)
         
     | 
| 
      
 16 
     | 
    
         
            +
                  
         
     | 
| 
      
 17 
     | 
    
         
            +
                if block_given?
         
     | 
| 
      
 18 
     | 
    
         
            +
                  yield from, to, options
         
     | 
| 
      
 19 
     | 
    
         
            +
                else
         
     | 
| 
      
 20 
     | 
    
         
            +
                  assert_equal column_names(from), column_names(to)
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
                
         
     | 
| 
      
 23 
     | 
    
         
            +
                @connection.drop_table(to) rescue nil
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              def test_copy_table_renaming_column
         
     | 
| 
      
 27 
     | 
    
         
            +
                test_copy_table('companies', 'companies2', 
         
     | 
| 
      
 28 
     | 
    
         
            +
                    :rename => {'client_of' => 'fan_of'}) do |from, to, options|
         
     | 
| 
      
 29 
     | 
    
         
            +
                  expected = column_values(from, 'client_of')
         
     | 
| 
      
 30 
     | 
    
         
            +
                  assert expected.any?, 'only nils in resultset; real values are needed'
         
     | 
| 
      
 31 
     | 
    
         
            +
                  assert_equal expected, column_values(to, 'fan_of')
         
     | 
| 
      
 32 
     | 
    
         
            +
                end
         
     | 
| 
      
 33 
     | 
    
         
            +
              end
         
     | 
| 
      
 34 
     | 
    
         
            +
              
         
     | 
| 
      
 35 
     | 
    
         
            +
              def test_copy_table_with_index
         
     | 
| 
      
 36 
     | 
    
         
            +
                test_copy_table('comments', 'comments_with_index') do
         
     | 
| 
      
 37 
     | 
    
         
            +
                  @connection.add_index('comments_with_index', ['post_id', 'type'])
         
     | 
| 
      
 38 
     | 
    
         
            +
                  test_copy_table('comments_with_index', 'comments_with_index2') do
         
     | 
| 
      
 39 
     | 
    
         
            +
                    assert_equal table_indexes_without_name('comments_with_index'),
         
     | 
| 
      
 40 
     | 
    
         
            +
                                 table_indexes_without_name('comments_with_index2')
         
     | 
| 
      
 41 
     | 
    
         
            +
                  end
         
     | 
| 
      
 42 
     | 
    
         
            +
                end
         
     | 
| 
      
 43 
     | 
    
         
            +
              end
         
     | 
| 
      
 44 
     | 
    
         
            +
              
         
     | 
| 
      
 45 
     | 
    
         
            +
              def test_copy_table_without_primary_key
         
     | 
| 
      
 46 
     | 
    
         
            +
                test_copy_table('developers_projects', 'programmers_projects')
         
     | 
| 
      
 47 
     | 
    
         
            +
              end
         
     | 
| 
      
 48 
     | 
    
         
            +
              
         
     | 
| 
      
 49 
     | 
    
         
            +
            protected
         
     | 
| 
      
 50 
     | 
    
         
            +
              def copy_table(from, to, options = {})
         
     | 
| 
      
 51 
     | 
    
         
            +
                @connection.copy_table(from, to, {:temporary => true}.merge(options))
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              def column_names(table)
         
     | 
| 
      
 55 
     | 
    
         
            +
                @connection.table_structure(table).map {|column| column['name']}
         
     | 
| 
      
 56 
     | 
    
         
            +
              end
         
     | 
| 
      
 57 
     | 
    
         
            +
              
         
     | 
| 
      
 58 
     | 
    
         
            +
              def column_values(table, column)
         
     | 
| 
      
 59 
     | 
    
         
            +
                @connection.select_all("SELECT #{column} FROM #{table} ORDER BY id").map {|row| row[column]}
         
     | 
| 
      
 60 
     | 
    
         
            +
              end
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
              def table_indexes_without_name(table)
         
     | 
| 
      
 63 
     | 
    
         
            +
                @connection.indexes('comments_with_index').delete(:name)
         
     | 
| 
      
 64 
     | 
    
         
            +
              end
         
     | 
| 
      
 65 
     | 
    
         
            +
              
         
     | 
| 
      
 66 
     | 
    
         
            +
              def row_count(table)
         
     | 
| 
      
 67 
     | 
    
         
            +
                @connection.select_one("SELECT COUNT(*) AS count FROM #{table}")['count']
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,203 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'abstract_unit'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class PostgresqlArray < ActiveRecord::Base
         
     | 
| 
      
 4 
     | 
    
         
            +
            end
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            class PostgresqlMoney < ActiveRecord::Base
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            class PostgresqlNumber < ActiveRecord::Base
         
     | 
| 
      
 10 
     | 
    
         
            +
            end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            class PostgresqlTime < ActiveRecord::Base
         
     | 
| 
      
 13 
     | 
    
         
            +
            end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            class PostgresqlNetworkAddress < ActiveRecord::Base
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            class PostgresqlBitString < ActiveRecord::Base
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            class PostgresqlOid < ActiveRecord::Base
         
     | 
| 
      
 22 
     | 
    
         
            +
            end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            class PostgresqlDataTypeTest < Test::Unit::TestCase
         
     | 
| 
      
 25 
     | 
    
         
            +
              self.use_transactional_fixtures = false
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              def setup
         
     | 
| 
      
 28 
     | 
    
         
            +
                @connection = ActiveRecord::Base.connection
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_arrays (commission_by_quarter, nicknames) VALUES ( '{35000,21000,18000,17000}', '{foo,bar,baz}' )")
         
     | 
| 
      
 31 
     | 
    
         
            +
                @first_array = PostgresqlArray.find(1)
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('$567.89')")
         
     | 
| 
      
 34 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_moneys (wealth) VALUES ('-$567.89')")
         
     | 
| 
      
 35 
     | 
    
         
            +
                @first_money = PostgresqlMoney.find(1)
         
     | 
| 
      
 36 
     | 
    
         
            +
                @second_money = PostgresqlMoney.find(2)
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_numbers (single, double) VALUES (123.456, 123456.789)")
         
     | 
| 
      
 39 
     | 
    
         
            +
                @first_number = PostgresqlNumber.find(1)
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_times (time_interval) VALUES ('1 year 2 days ago')")
         
     | 
| 
      
 42 
     | 
    
         
            +
                @first_time = PostgresqlTime.find(1)
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_network_addresses (cidr_address, inet_address, mac_address) VALUES('192.168.0/24', '172.16.1.254/32', '01:23:45:67:89:0a')")
         
     | 
| 
      
 45 
     | 
    
         
            +
                @first_network_address = PostgresqlNetworkAddress.find(1)
         
     | 
| 
      
 46 
     | 
    
         
            +
                
         
     | 
| 
      
 47 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_bit_strings (bit_string, bit_string_varying) VALUES (B'00010101', X'15')")
         
     | 
| 
      
 48 
     | 
    
         
            +
                @first_bit_string = PostgresqlBitString.find(1)
         
     | 
| 
      
 49 
     | 
    
         
            +
                
         
     | 
| 
      
 50 
     | 
    
         
            +
                @connection.execute("INSERT INTO postgresql_oids (obj_id) VALUES (1234)")
         
     | 
| 
      
 51 
     | 
    
         
            +
                @first_oid = PostgresqlOid.find(1)
         
     | 
| 
      
 52 
     | 
    
         
            +
              end
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
              def test_data_type_of_array_types
         
     | 
| 
      
 55 
     | 
    
         
            +
                assert_equal :string, @first_array.column_for_attribute(:commission_by_quarter).type
         
     | 
| 
      
 56 
     | 
    
         
            +
                assert_equal :string, @first_array.column_for_attribute(:nicknames).type
         
     | 
| 
      
 57 
     | 
    
         
            +
              end
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
              def test_data_type_of_money_types
         
     | 
| 
      
 60 
     | 
    
         
            +
                assert_equal :decimal, @first_money.column_for_attribute(:wealth).type
         
     | 
| 
      
 61 
     | 
    
         
            +
              end
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
              def test_data_type_of_number_types
         
     | 
| 
      
 64 
     | 
    
         
            +
                assert_equal :float, @first_number.column_for_attribute(:single).type
         
     | 
| 
      
 65 
     | 
    
         
            +
                assert_equal :float, @first_number.column_for_attribute(:double).type
         
     | 
| 
      
 66 
     | 
    
         
            +
              end
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
              def test_data_type_of_time_types
         
     | 
| 
      
 69 
     | 
    
         
            +
                assert_equal :string, @first_time.column_for_attribute(:time_interval).type
         
     | 
| 
      
 70 
     | 
    
         
            +
              end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
              def test_data_type_of_network_address_types
         
     | 
| 
      
 73 
     | 
    
         
            +
                assert_equal :string, @first_network_address.column_for_attribute(:cidr_address).type
         
     | 
| 
      
 74 
     | 
    
         
            +
                assert_equal :string, @first_network_address.column_for_attribute(:inet_address).type
         
     | 
| 
      
 75 
     | 
    
         
            +
                assert_equal :string, @first_network_address.column_for_attribute(:mac_address).type
         
     | 
| 
      
 76 
     | 
    
         
            +
              end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
              def test_data_type_of_bit_string_types
         
     | 
| 
      
 79 
     | 
    
         
            +
                assert_equal :string, @first_bit_string.column_for_attribute(:bit_string).type
         
     | 
| 
      
 80 
     | 
    
         
            +
                assert_equal :string, @first_bit_string.column_for_attribute(:bit_string_varying).type
         
     | 
| 
      
 81 
     | 
    
         
            +
              end
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
              def test_data_type_of_oid_types
         
     | 
| 
      
 84 
     | 
    
         
            +
                assert_equal :integer, @first_oid.column_for_attribute(:obj_id).type
         
     | 
| 
      
 85 
     | 
    
         
            +
              end
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
              def test_array_values
         
     | 
| 
      
 88 
     | 
    
         
            +
               assert_equal '{35000,21000,18000,17000}', @first_array.commission_by_quarter
         
     | 
| 
      
 89 
     | 
    
         
            +
               assert_equal '{foo,bar,baz}', @first_array.nicknames
         
     | 
| 
      
 90 
     | 
    
         
            +
              end
         
     | 
| 
      
 91 
     | 
    
         
            +
             
     | 
| 
      
 92 
     | 
    
         
            +
              def test_money_values
         
     | 
| 
      
 93 
     | 
    
         
            +
                assert_equal 567.89, @first_money.wealth
         
     | 
| 
      
 94 
     | 
    
         
            +
                assert_equal -567.89, @second_money.wealth
         
     | 
| 
      
 95 
     | 
    
         
            +
              end
         
     | 
| 
      
 96 
     | 
    
         
            +
             
     | 
| 
      
 97 
     | 
    
         
            +
              def test_number_values
         
     | 
| 
      
 98 
     | 
    
         
            +
                assert_equal 123.456, @first_number.single
         
     | 
| 
      
 99 
     | 
    
         
            +
                assert_equal 123456.789, @first_number.double
         
     | 
| 
      
 100 
     | 
    
         
            +
              end
         
     | 
| 
      
 101 
     | 
    
         
            +
             
     | 
| 
      
 102 
     | 
    
         
            +
              def test_time_values
         
     | 
| 
      
 103 
     | 
    
         
            +
                assert_equal '-1 years -2 days', @first_time.time_interval
         
     | 
| 
      
 104 
     | 
    
         
            +
              end
         
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
              def test_network_address_values
         
     | 
| 
      
 107 
     | 
    
         
            +
                assert_equal '192.168.0.0/24', @first_network_address.cidr_address
         
     | 
| 
      
 108 
     | 
    
         
            +
                assert_equal '172.16.1.254', @first_network_address.inet_address
         
     | 
| 
      
 109 
     | 
    
         
            +
                assert_equal '01:23:45:67:89:0a', @first_network_address.mac_address
         
     | 
| 
      
 110 
     | 
    
         
            +
              end
         
     | 
| 
      
 111 
     | 
    
         
            +
             
     | 
| 
      
 112 
     | 
    
         
            +
              def test_bit_string_values
         
     | 
| 
      
 113 
     | 
    
         
            +
                assert_equal '00010101', @first_bit_string.bit_string
         
     | 
| 
      
 114 
     | 
    
         
            +
                assert_equal '00010101', @first_bit_string.bit_string_varying
         
     | 
| 
      
 115 
     | 
    
         
            +
              end
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
              def test_oid_values
         
     | 
| 
      
 118 
     | 
    
         
            +
                assert_equal 1234, @first_oid.obj_id
         
     | 
| 
      
 119 
     | 
    
         
            +
              end
         
     | 
| 
      
 120 
     | 
    
         
            +
             
     | 
| 
      
 121 
     | 
    
         
            +
              def test_update_integer_array
         
     | 
| 
      
 122 
     | 
    
         
            +
                new_value = '{32800,95000,29350,17000}'
         
     | 
| 
      
 123 
     | 
    
         
            +
                assert @first_array.commission_by_quarter = new_value
         
     | 
| 
      
 124 
     | 
    
         
            +
                assert @first_array.save
         
     | 
| 
      
 125 
     | 
    
         
            +
                assert @first_array.reload
         
     | 
| 
      
 126 
     | 
    
         
            +
                assert_equal @first_array.commission_by_quarter, new_value
         
     | 
| 
      
 127 
     | 
    
         
            +
                assert @first_array.commission_by_quarter = new_value
         
     | 
| 
      
 128 
     | 
    
         
            +
                assert @first_array.save
         
     | 
| 
      
 129 
     | 
    
         
            +
                assert @first_array.reload
         
     | 
| 
      
 130 
     | 
    
         
            +
                assert_equal @first_array.commission_by_quarter, new_value
         
     | 
| 
      
 131 
     | 
    
         
            +
              end
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
              def test_update_text_array
         
     | 
| 
      
 134 
     | 
    
         
            +
                new_value = '{robby,robert,rob,robbie}'
         
     | 
| 
      
 135 
     | 
    
         
            +
                assert @first_array.nicknames = new_value
         
     | 
| 
      
 136 
     | 
    
         
            +
                assert @first_array.save
         
     | 
| 
      
 137 
     | 
    
         
            +
                assert @first_array.reload
         
     | 
| 
      
 138 
     | 
    
         
            +
                assert_equal @first_array.nicknames, new_value
         
     | 
| 
      
 139 
     | 
    
         
            +
                assert @first_array.nicknames = new_value
         
     | 
| 
      
 140 
     | 
    
         
            +
                assert @first_array.save
         
     | 
| 
      
 141 
     | 
    
         
            +
                assert @first_array.reload
         
     | 
| 
      
 142 
     | 
    
         
            +
                assert_equal @first_array.nicknames, new_value
         
     | 
| 
      
 143 
     | 
    
         
            +
              end
         
     | 
| 
      
 144 
     | 
    
         
            +
             
     | 
| 
      
 145 
     | 
    
         
            +
              def test_update_money
         
     | 
| 
      
 146 
     | 
    
         
            +
                new_value = 123.45
         
     | 
| 
      
 147 
     | 
    
         
            +
                assert @first_money.wealth = new_value
         
     | 
| 
      
 148 
     | 
    
         
            +
                assert @first_money.save
         
     | 
| 
      
 149 
     | 
    
         
            +
                assert @first_money.reload
         
     | 
| 
      
 150 
     | 
    
         
            +
                assert_equal @first_money.wealth, new_value
         
     | 
| 
      
 151 
     | 
    
         
            +
              end
         
     | 
| 
      
 152 
     | 
    
         
            +
             
     | 
| 
      
 153 
     | 
    
         
            +
              def test_update_number
         
     | 
| 
      
 154 
     | 
    
         
            +
                new_single = 789.012
         
     | 
| 
      
 155 
     | 
    
         
            +
                new_double = 789012.345
         
     | 
| 
      
 156 
     | 
    
         
            +
                assert @first_number.single = new_single
         
     | 
| 
      
 157 
     | 
    
         
            +
                assert @first_number.double = new_double
         
     | 
| 
      
 158 
     | 
    
         
            +
                assert @first_number.save
         
     | 
| 
      
 159 
     | 
    
         
            +
                assert @first_number.reload
         
     | 
| 
      
 160 
     | 
    
         
            +
                assert_equal @first_number.single, new_single
         
     | 
| 
      
 161 
     | 
    
         
            +
                assert_equal @first_number.double, new_double
         
     | 
| 
      
 162 
     | 
    
         
            +
              end
         
     | 
| 
      
 163 
     | 
    
         
            +
             
     | 
| 
      
 164 
     | 
    
         
            +
              def test_update_time
         
     | 
| 
      
 165 
     | 
    
         
            +
                assert @first_time.time_interval = '2 years 3 minutes'
         
     | 
| 
      
 166 
     | 
    
         
            +
                assert @first_time.save
         
     | 
| 
      
 167 
     | 
    
         
            +
                assert @first_time.reload
         
     | 
| 
      
 168 
     | 
    
         
            +
                assert_equal @first_time.time_interval, '2 years 00:03:00'
         
     | 
| 
      
 169 
     | 
    
         
            +
              end
         
     | 
| 
      
 170 
     | 
    
         
            +
             
     | 
| 
      
 171 
     | 
    
         
            +
              def test_update_network_address
         
     | 
| 
      
 172 
     | 
    
         
            +
                new_cidr_address = '10.1.2.3/32'
         
     | 
| 
      
 173 
     | 
    
         
            +
                new_inet_address = '10.0.0.0/8'
         
     | 
| 
      
 174 
     | 
    
         
            +
                new_mac_address = 'bc:de:f0:12:34:56'
         
     | 
| 
      
 175 
     | 
    
         
            +
                assert @first_network_address.cidr_address = new_cidr_address
         
     | 
| 
      
 176 
     | 
    
         
            +
                assert @first_network_address.inet_address = new_inet_address
         
     | 
| 
      
 177 
     | 
    
         
            +
                assert @first_network_address.mac_address = new_mac_address
         
     | 
| 
      
 178 
     | 
    
         
            +
                assert @first_network_address.save
         
     | 
| 
      
 179 
     | 
    
         
            +
                assert @first_network_address.reload
         
     | 
| 
      
 180 
     | 
    
         
            +
                assert_equal @first_network_address.cidr_address, new_cidr_address
         
     | 
| 
      
 181 
     | 
    
         
            +
                assert_equal @first_network_address.inet_address, new_inet_address
         
     | 
| 
      
 182 
     | 
    
         
            +
                assert_equal @first_network_address.mac_address, new_mac_address
         
     | 
| 
      
 183 
     | 
    
         
            +
              end
         
     | 
| 
      
 184 
     | 
    
         
            +
             
     | 
| 
      
 185 
     | 
    
         
            +
              def test_update_bit_string
         
     | 
| 
      
 186 
     | 
    
         
            +
                new_bit_string = '11111111'
         
     | 
| 
      
 187 
     | 
    
         
            +
                new_bit_string_varying = 'FF'
         
     | 
| 
      
 188 
     | 
    
         
            +
                assert @first_bit_string.bit_string = new_bit_string
         
     | 
| 
      
 189 
     | 
    
         
            +
                assert @first_bit_string.bit_string_varying = new_bit_string_varying
         
     | 
| 
      
 190 
     | 
    
         
            +
                assert @first_bit_string.save
         
     | 
| 
      
 191 
     | 
    
         
            +
                assert @first_bit_string.reload
         
     | 
| 
      
 192 
     | 
    
         
            +
                assert_equal @first_bit_string.bit_string, new_bit_string
         
     | 
| 
      
 193 
     | 
    
         
            +
                assert_equal @first_bit_string.bit_string, @first_bit_string.bit_string_varying
         
     | 
| 
      
 194 
     | 
    
         
            +
              end
         
     | 
| 
      
 195 
     | 
    
         
            +
             
     | 
| 
      
 196 
     | 
    
         
            +
              def test_update_oid
         
     | 
| 
      
 197 
     | 
    
         
            +
                new_value = 567890
         
     | 
| 
      
 198 
     | 
    
         
            +
                assert @first_oid.obj_id = new_value
         
     | 
| 
      
 199 
     | 
    
         
            +
                assert @first_oid.save
         
     | 
| 
      
 200 
     | 
    
         
            +
                assert @first_oid.reload
         
     | 
| 
      
 201 
     | 
    
         
            +
                assert_equal @first_oid.obj_id, new_value
         
     | 
| 
      
 202 
     | 
    
         
            +
              end
         
     | 
| 
      
 203 
     | 
    
         
            +
            end
         
     |