if args.any?
if args.first.is_a?(Hash)
if @struct.last.is_a?(Array)
- @struct.last << args.first
+ @struct.last << args.first unless block
else
@struct.last[sym] = args.first
end
end
if block
- @struct << {}
+ @struct << (args.first.is_a?(Hash) ? args.first : {})
block.call(self)
ret = @struct.pop
if @struct.last.is_a?(Array)
b.book :title => 'Book 2', :author => 'G. Cooper'
end
end
+
+ assert_json_output({'books' => [{'title' => 'Book 1', 'author' => 'B. Smith'}, {'title' => 'Book 2', 'author' => 'G. Cooper'}]}) do |b|
+ b.array :books do |b|
+ b.book :title => 'Book 1' do
+ b.author 'B. Smith'
+ end
+ b.book :title => 'Book 2' do
+ b.author 'G. Cooper'
+ end
+ end
+ end
end
def test_array_with_content_tags