class TestActHtml

Public Instance Methods

test_big_page() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 184
def test_big_page
  t_site_open

  page = @site.create_new
  page.store("a" * (100 * 1024 + 1))

  res = session('/test/1.html') {|req| req.cookies.clear }
  ok_title "Page too big."
end
test_ext_html() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 116
def test_ext_html
  t_add_user
  t_site_open

  page = @site['1']
  eq nil, page
  
  res = session '/test/1.html'
  eq 404, @res.status
  ok_title 'Page not found.'

  page = @site.create_new
  page.store 't'

  res = session '/test/1.html'
  ok_in ['t'], "//div[@class='section']/p"

  # test_cache
  res = session('/test/') {|req|
    req.cookies.clear
  }
  # You can see the page.
  ok_title 'FrontPage'
  # But you are not logged in.
  ok_in ['Login'], "//div[@class='adminmenu']//a"
  eq 'text/html; charset=Shift_JIS', @res.headers['Content-Type']

  t_without_testmode {
    res = session('/test/') {|req|         # Do it again
      req.cookies.clear
    }
    assert_instance_of(File, res.body)     # The body is a cached content.
    str = res.body.read
    res.body.close         # Important.
    assert_match(/FrontPage/, str)
    eq 'text/html; charset=Shift_JIS', res.headers['Content-Type']
  }
end
test_guest_in_public_mode() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 171
def test_guest_in_public_mode
  t_site_open

  page = @site.create_new

  res = session('/test/1.html') {|req| req.cookies.clear }
  ok_title '1'

  res = session('/test/1.html') {|req| req.cookies.clear }
  ok_title '1'

end
test_private_page?() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 96
def test_private_page?
  eq false, Qwik::Action.private_page?('t')
  eq true,  Qwik::Action.private_page?('_t')
end
test_protect_underbar() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 101
def test_protect_underbar
  t_add_user

  page = @site.create '_t'
  page.store '*t'

  res = session '/test/_t.html'     # with login
  ok_title 't'

  res = session('/test/_t.html') {|req|
    req.cookies.clear
  }
  ok_title 'Login'
end
test_superpre_sharp_mark() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 194
    def test_superpre_sharp_mark
      t_add_user
      page = @site.create_new
      page.store '{{{
#t
}}}'
      session '/test/1.html'
      ok_in ["#t\n"], "//div[@class='section']/pre"
    end
test_wysiwyg_users() click to toggle source
# File vendor/qwik/lib/qwik/act-html.rb, line 155
def test_wysiwyg_users
  t_add_user
  t_site_open

  page = @site.create_new

  res = session '/test/1.html'
  ok_xp nil, '//meta'

  @config[:wysiwyg_users] = "a@e.com, #{DEFAULT_USER}, b@e.com"

  res = session('/test/1.html')
  ok_xp [:meta, {:content=>'0; url=1.wysiwyg', 'http-equiv'=>'Refresh'}],
    '//meta'
end