Sha256: d519be135e70191c7ac2cdfcbbc91b40a52a49e4e8429bd2abc02e70c7a5ab3e

Contents?: true

Size: 903 Bytes

Versions: 1

Compression:

Stored size: 903 Bytes

Contents

require "#{File.expand_path(File.dirname(__FILE__))}/../test_helper"

class XmlDataTest < ActiveSupport::TestCase

  def setup
    setup_db
  end

  def teardown
    teardown_db
  end

  test "xml rendering" do
    items = [Item.create(:name => "Item Name 1", :description => "hidden description", :number => 0),
             Item.create(:name => "Item Name 2", :description => "description", :number => 1)]
    ds = GoogleDataSource::DataSource::Base.from_params({:tqx => "reqId:0;out:xml"})
    
    columns = [
      {:id => 'name', :label => 'Name', :type => 'string'},
      {:id => 'number', :label => 'Number', :type => 'number'},
    ]
    ds.set(items, columns)

    xml = Nokogiri::XML(ds.response)

    assert xml.xml?
    assert_equal 2, xml.root.css('item').size
    assert_equal 'Item Name 1', xml.root.css('item name').first.child.inner_text
    assert_equal 0, xml.errors.size
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
google_data_source-0.7.6 test/units/xml_data_test.rb