Class: ErrorMessageTest

Inherits:
Test::Unit::TestCase
  • Object
show all
Defined in:
lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb

Instance Method Summary collapse

Instance Method Details

#setupObject



4
5
6
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb', line 4

def setup
  @error = ActiveScaffold::DataStructures::ErrorMessage.new 'foo'
end

#test_attributesObject



8
9
10
11
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb', line 8

def test_attributes
  assert @error.public_attributes.has_key?(:error)
  assert_equal 'foo', @error.public_attributes[:error]
end

#test_xmlObject



13
14
15
16
17
18
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb', line 13

def test_xml
  xml = Hash.from_xml(@error.to_xml)
  assert xml.has_key?('errors')
  assert xml['errors'].has_key?('error')
  assert_equal 'foo', xml['errors']['error']
end

#test_yamlObject



20
21
22
23
24
25
26
27
# File 'lib/six-updater-web/vendor/plugins/active_scaffold/test/data_structures/error_message_test.rb', line 20

def test_yaml
  yml = nil
  assert_nothing_raised do
    yml = YAML.load(@error.to_yaml)
  end
  assert yml.has_key?(:error)
  assert_equal 'foo', yml[:error]
end