-require 'abstract_unit'\r
-require 'fixtures/reference_type'\r
-require 'fixtures/reference_code'\r
-\r
-class TestUpdate < Test::Unit::TestCase\r
- fixtures :reference_types, :reference_codes\r
- \r
- CLASSES = {\r
- :single => {\r
- :class => ReferenceType,\r
- :primary_keys => :reference_type_id,\r
- :update => { :description => 'RT Desc' },\r
- },\r
- :dual => { \r
- :class => ReferenceCode,\r
- :primary_keys => [:reference_type_id, :reference_code],\r
- :update => { :description => 'RT Desc' },\r
- },\r
- }\r
- \r
- def setup\r
- self.class.classes = CLASSES\r
- end\r
- \r
- def test_setup\r
- testing_with do\r
- assert_not_nil @klass_info[:update]\r
- end\r
- end\r
- \r
- def test_update_attributes\r
- testing_with do\r
- assert @first.update_attributes(@klass_info[:update])\r
- assert @first.reload\r
- @klass_info[:update].each_pair do |attr_name, new_value|\r
- assert_equal new_value, @first[attr_name], "Attribute #{attr_name} is incorrect"\r
- end\r
- end\r
- end\r
+require 'abstract_unit'
+require 'fixtures/reference_type'
+require 'fixtures/reference_code'
+
+class TestUpdate < Test::Unit::TestCase
+ fixtures :reference_types, :reference_codes
+
+ CLASSES = {
+ :single => {
+ :class => ReferenceType,
+ :primary_keys => :reference_type_id,
+ :update => { :description => 'RT Desc' },
+ },
+ :dual => {
+ :class => ReferenceCode,
+ :primary_keys => [:reference_type_id, :reference_code],
+ :update => { :description => 'RT Desc' },
+ },
+ }
+
+ def setup
+ self.class.classes = CLASSES
+ end
+
+ def test_setup
+ testing_with do
+ assert_not_nil @klass_info[:update]
+ end
+ end
+
+ def test_update_attributes
+ testing_with do
+ assert @first.update_attributes(@klass_info[:update])
+ assert @first.reload
+ @klass_info[:update].each_pair do |attr_name, new_value|
+ assert_equal new_value, @first[attr_name], "Attribute #{attr_name} is incorrect"
+ end
+ end
+ end
end
\ No newline at end of file