aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/xml_serialization_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Should escape regexp wildcard character `.`Ryuta Kamizono2015-01-191-1/+1
| | | | | `.` is regexp meta character. It should be escape for `assert_match` correctly.
* Test the serialized types of virtual columns in XMLGeoff Petrie & Sean Griffin2014-06-011-2/+3
| | | | | | | The previous tests were passing, because nothing ever looked at the generated XML. What was previously being generated was `<firstname type="NilClass">...`, which is not consistent with all other cases where there is not a known type.
* Remove dead test code for unsupported adaptersSean Griffin2014-05-171-9/+3
|
* require dependency to execute a single test from xml_serialization_testYves Senn2014-03-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | When the tests are executed in order, the dependency is loaded at the right time. However this makes it impossible to execute a single test later down the line. Let's require the dependecy at the beginning to get them working independent of the order. This resolves the following error: ``` $ ARCONN=postgresql ruby -Itest /Users/senny/Projects/rails/activerecord/test/cases/xml_serialization_test.rb -n test_to_xml Using postgresql Run options: -n test_to_xml --seed 51819 E Finished in 0.081320s, 12.2971 runs/s, 0.0000 assertions/s. 1) Error: DatabaseConnectedXmlSerializationTest#test_to_xml: NameError: uninitialized constant DatabaseConnectedXmlSerializationTest::REXML /Users/senny/Projects/rails/activerecord/test/cases/xml_serialization_test.rb:226:in `test_to_xml' ``` /cc @tgxworld fyi
* prevent global timezone state from leaking out of test cases.Yves Senn2013-10-251-12/+8
|
* Fix AR tests due to builder change with nil values / empty stringsCarlos Antonio da Silva2012-09-071-6/+6
| | | | | Check 0180e090ab6cbe66f7b521a0c03e278a0463accd for more reasoning about that.
* Remove ActiveRecord::Base.to_aJon Leighton2012-08-031-1/+1
| | | | | On reflection, it seems like a bit of a weird method to have on ActiveRecord::Base, and it shouldn't be needed most of the time anyway.
* ActiveRecord::Base.all returns a Relation.Jon Leighton2012-07-271-1/+1
| | | | | | | | | | | Previously it returned an Array. If you want an array, call e.g. `Post.to_a` rather than `Post.all`. This is more explicit. In most cases this should not break existing code, since Relations use method_missing to delegate unknown methods to #to_a anyway.
* Fix serializable_hash with xml generation and default :except optionCarlos Antonio da Silva2012-06-221-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | When generating xml with a custom implementation of serializable_hash, if using the :except option, it was being overriden by the default AR implementation that attempts to ignore the inheritance column from STI automatically. So, if you have an implementation like this: def serializable_hash(options={}) super({ except: %w(some_attr) }.merge!(options)) end The :except option was correctly being used for :json generation, but not for :xml, because the options hash already contained the :except key with the inheritance column, thus overriding the customization. This commit fixes this problem by removing the :except logic from the xml serializer, that happened before calling serializable_hash. Since serializable_hash also does the same check for inheritance column, this logic was duplicated in both places, thus it's safe to remove it from xml serializer (see ActiveRecord::Serialization#serializable_hash). This is an attempt to solve issue #2498, that claims for a "Single transformation API for both xml and json representations".
* Add some coverage for AR serialization with serializable_hashCarlos Antonio da Silva2012-06-221-9/+49
| | | | | | ActiveRecord json/xml serialization should use as base serializable_hash, provided by ActiveModel. Add some more coverage around options :only and :except for both json and xml serialization.
* changed xml type datetime to dateTime, fixes #6328Angelo capilleri2012-05-231-7/+7
| | | | | | | | | XmlMini define the xml 'datatime', but according to http://www.w3.org/TR/xmlschema-2/#dateTime could be better change this to 'dateTime' with upper case letter 'T. So 'DateTime' and 'Time' are redefined from 'datetime' to 'dateTime' add the changing to the changelog
* Move to_xml tests to xml_serialization_test.rbJohn Firebaugh2011-07-171-1/+133
| | | | | One duplicate was eliminated: test_to_xml_including_methods/ test_methods_are_called_on_object.
* please use ruby -I lib:test path/to/test.rb, or export RUBY_OPTAaron Patterson2011-06-061-1/+1
|
* Refactor Active Record test connection setup. Please see the ↵Jon Leighton2011-06-041-1/+1
| | | | RUNNING_UNIT_TESTS file for details, but essentially you can now configure things in test/config.yml. You can also run tests directly via the command line, e.g. ruby path/to/test.rb (no rake needed, uses default db connection from test/config.yml). This will help us fix the CI by enabling us to isolate the different Rails versions to different databases.
* Methods that return nil should not be considered YAMLJoshua Wehner2011-05-101-4/+1
|
* Provide test for #4840: to_xml doesn't work in such case: ↵Franck Verrot2010-12-151-0/+6
| | | | Event.select('title as t').to_xml
* Take into account current time zone when serializing datetime values [#6096 ↵Mike Dvorkin2010-12-091-0/+21
| | | | | | state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* removing unused models from testsSubba Rao Pasupuleti2010-07-211-1/+0
| | | | | | [#5153 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* test cases for record.to_xml [#458 state:resolved]Neeraj Singh2010-04-301-0/+8
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Move several configuration values from Hash to ActiveSupport::XmlMini, which ↵José Valim2010-04-291-2/+2
| | | | | | both Hash and Array depends on. Also, refactored ActiveModel serializers to just use ActiveSupport::XmlMini.to_tag. As consequence, if a serialized attribute is an array or a hash, it's not encoded as yaml, but as a hash or array.
* Missing require addedSantiago Pastorino2010-04-181-0/+1
|
* working around syck defects by optionally matching a space [#4426 ↵Aaron Patterson2010-04-171-1/+1
| | | | | | state:resolved] Signed-off-by: wycats <wycats@gmail.com>
* Made arrays of ActiveRecords, and any classes, with namespaces convert to ↵mfoster2010-04-101-1/+11
| | | | | | valid xml. [#3824 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Patch to ActiveModel's (and ActiveRecord, by association) XML serialization: ↵John Maxwell2009-07-221-0/+6
| | | | | | If two parameters are present in Procs supplied to to_xml's :procs option, the model being serialized will be passed as the second argument [#2373 state:resolved] Signed-off-by: Joshua Peek <josh@joshpeek.com>
* Ensure ActiveRecord#to_xml respects :skip_types for included associations ↵Bruce Krysiak2009-03-101-1/+12
| | | | | | [#1632 state:resolved] Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
* Added a :camelize option to ActiveRecord and Hash to_xml serialization and ↵Bruce Krysiak2008-12-101-0/+7
| | | | | | from_xml deserialization Signed-off-by: Michael Koziarski <michael@koziarski.com>
* Merge branch 'ar-test-cleanup' of git://git.geeksomnia.com/railsJeremy Kemper2008-01-211-5/+5
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8681 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Fix pathsJeremy Kemper2008-01-181-6/+6
| | | | git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8661 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
* Move tests to casesJeremy Kemper2008-01-181-0/+202
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8660 5ecf4fe2-1ee6-0310-87b1-e25e094e27de