Mercurial > hg > soundsoftware-site
comparison test/unit/lib/redmine/views/builders/xml_test.rb @ 1115:433d4f72a19b redmine-2.2
Update to Redmine SVN revision 11137 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Mon, 07 Jan 2013 12:01:42 +0000 |
parents | cbb26bc654de |
children | 622f24f53b42 |
comparison
equal
deleted
inserted
replaced
929:5f33065ddc4b | 1115:433d4f72a19b |
---|---|
1 # Redmine - project management software | 1 # Redmine - project management software |
2 # Copyright (C) 2006-2011 Jean-Philippe Lang | 2 # Copyright (C) 2006-2012 Jean-Philippe Lang |
3 # | 3 # |
4 # This program is free software; you can redistribute it and/or | 4 # This program is free software; you can redistribute it and/or |
5 # modify it under the terms of the GNU General Public License | 5 # modify it under the terms of the GNU General Public License |
6 # as published by the Free Software Foundation; either version 2 | 6 # as published by the Free Software Foundation; either version 2 |
7 # of the License, or (at your option) any later version. | 7 # of the License, or (at your option) any later version. |
44 b.book 'Book 2', :author => 'G. Cooper' | 44 b.book 'Book 2', :author => 'G. Cooper' |
45 end | 45 end |
46 end | 46 end |
47 end | 47 end |
48 | 48 |
49 def test_nested_arrays | |
50 assert_xml_output('<books type="array"><book><authors type="array"><author>B. Smith</author><author>G. Cooper</author></authors></book></books>') do |b| | |
51 b.array :books do |books| | |
52 books.book do |book| | |
53 book.array :authors do |authors| | |
54 authors.author 'B. Smith' | |
55 authors.author 'G. Cooper' | |
56 end | |
57 end | |
58 end | |
59 end | |
60 end | |
61 | |
49 def assert_xml_output(expected, &block) | 62 def assert_xml_output(expected, &block) |
50 builder = Redmine::Views::Builders::Xml.new | 63 builder = Redmine::Views::Builders::Xml.new(ActionDispatch::TestRequest.new, ActionDispatch::TestResponse.new) |
51 block.call(builder) | 64 block.call(builder) |
52 assert_equal('<?xml version="1.0" encoding="UTF-8"?>' + expected, builder.output) | 65 assert_equal('<?xml version="1.0" encoding="UTF-8"?>' + expected, builder.output) |
53 end | 66 end |
54 end | 67 end |