class TestActMetadata

Public Instance Methods

test_all() click to toggle source
# File vendor/qwik/lib/qwik/act-metadata.rb, line 224
    def test_all
      page = @site.create_new
      page.put_with_time('* t', 0)

      # test_get_rss20
      res = session('/test/rss.xml')
      ok_eq('application/xml', res['Content-Type'])
      result = HTree(res.body).to_wabisabi
      ok_eq(
[[:'?xml', '1.0', 'utf-8'],
 [:rss,
  {:version=>'2.0'},
  [:channel,
   [:title, 'example.com/test'],
   [:link, 'http://example.com/test/'],
   [:description,
    'a private qwikWeb site.
Since this site is in private mode, the feed includes minimum data.'],
   [:language, 'ja'],
   [:pubdate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
   [:lastbuilddate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
   [:generator, 'qwikWeb'],
   [:item,
    [:title, '1'],
    [:link, 'http://example.com/test/1.html'],
    [:description, 'Thu, 01 Jan 1970 09:00:00 GMT'],
    [:pubdate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
    [:guid, 'http://example.com/test/1.html']]]]], result)

      # test_get_atom
      res = session('/test/atom.xml')
      ok_eq('application/xml', res['Content-Type'])
      is "<?xml version=\"1.0\" encoding=\"utf-8\"?><feed xmlns=\"http://www.w3.org/2005/atom\"\n><title\n>example.com/test</title\n><link href=\"http://example.com/test/\" rel=\"alternate\" type=\"text/html\"\n/><link href=\"http://example.com/test/atom.xml\" rel=\"self\" type=\"application/atom+xml\"\n/><generator uri=\"http://qwik.jp/\"\n>qwikWeb</generator\n><updated\n>1970-01-01T09:00:00Z</updated\n><entry\n><title\n>1</title\n><link href=\"http://example.com/test/1.html\" rel=\"alternate\" type=\"text/html\"\n/><updated\n>1970-01-01T09:00:00Z</updated\n><summary\n>Thu, 01 Jan 1970 09:00:00 GMT</summary\n></entry\n></feed\n>", res.body

      t_site_open       # Public site.

      # test_get_public_rss20
      res = session('/test/rss.xml')
      ok_eq('application/xml', res['Content-Type'])
      result = HTree(res.body).to_wabisabi
      assert_not_equal(
[[:'?xml', '1.0', 'utf-8'],
 [:rss,
  {:version=>'2.0'},
  [:channel,
   [:title, 'example.com/test'],
   [:link, 'http://example.com/test/'],
   [:description, 'a public qwikWeb site.'],
   [:language, 'ja'],
   [:pubdate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
   [:lastbuilddate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
   [:generator, 'qwikWeb'],
   [:item,
    [:title, 't'],
    [:link, 'http://example.com/test/1.html'],
    [:description, '* t'],
    [:pubdate, 'Thu, 01 Jan 1970 09:00:00 GMT'],
    [:guid, 'http://example.com/test/1.html']]]]], result)

      # test_get_public_atom
      res = session('/test/atom.xml')
      ok_eq('application/xml', res['Content-Type'])
      result = HTree(res.body).to_wabisabi
      assert_not_equal(
[[:'?xml', '1.0', 'utf-8'],
 [:feed,
  {:xmlns=>'http://www.w3.org/2005/atom'},
  [:title, 'example.com/test'],
  [:link,
   {:href=>'http://example.com/test/', :type=>'text/html', :rel=>'alternate'}],
  [:link,
   {:href=>'http://example.com/test/atom.xml',
    :type=>'application/atom+xml',
    :rel=>'self'}],
  [:generator, {:uri=>'http://qwik.jp/', :version=>'0.5.2'}, 'qwikWeb'],
  [:updated, '1970-01-01T09:00:00Z'],
  [:entry,
   [:title, 't'],
   [:link,
    {:href=>'http://example.com/test/1.html',
     :type=>'text/html',
     :rel=>'alternate'}],
   [:updated, '1970-01-01T09:00:00Z'],
   [:summary, '* t']]]], result)
    end
test_many_pages() click to toggle source
# File vendor/qwik/lib/qwik/act-metadata.rb, line 310
def test_many_pages
  (1..20).each {|n|
    page = @site.create_new
    page.put_with_time("* t#{n}", n)
  }

  # The RSS contains only 10 items.
  res = session('/test/rss.xml')
  ok_eq('application/xml', res['Content-Type'])
  result = HTree(res.body).to_wabisabi
  eq 19, result[1][2].length
end
test_plg_atom() click to toggle source
# File vendor/qwik/lib/qwik/act-metadata.rb, line 217
def test_plg_atom
  ok_wi([:p, [:a, {:href=>'atom.xml'}, 'atom.xml']], '[[atom.xml]]')
  ok_wi([:p, [:a, {:href=>'atom.xml'}, 'a']], '[[a|atom.xml]]')
  ok_wi([:a, {:class=>'rss-button', :href=>'atom.xml'}, [:span, 'ATOM']],
        '{{atom}}')
end
test_plg_rss() click to toggle source
# File vendor/qwik/lib/qwik/act-metadata.rb, line 211
def test_plg_rss
  ok_wi([:a, {:class=>'rss-button', :href=>'rss.xml'}, [:span, 'RSS']],
        '{{rss}}')
  ok_wi([:p, [:a, {:href=>'test.rss'}, 'test.rss']], '[[test.rss]]')
end
test_rss_button() click to toggle source
# File vendor/qwik/lib/qwik/act-metadata.rb, line 205
def test_rss_button
  res = session
  ok_eq([:a, {:class=>'rss-button', :href=>'href'}, [:span, 'msg']],
        @action.rss_button('href', 'msg'))
end