class TestAction

Public Instance Methods

test_aa() click to toggle source
# File vendor/qwik/lib/qwik/act-aa.rb, line 69
def test_aa
  # test_aa
  ok_wi([:pre, {:class=>'aa'}, "a\n"], "{{aa\na\n}}")

  # test_show_aa
  ok_wi([:pre, {:class=>'aa'}, "(^_^) Hi!"], '{{show_aa(smile)}}')
  ok_wi([:pre, {:class=>'aa'}, "(^_^) Bye!"], '{{show_aa(smile, Bye!)}}')
  ok_wi(/monar/, '{{show_aa(モナー, monar)}}')
  ok_wi(/kumar/, '{{show_aa(クマァ, kumar)}}')

  #eq true, @dir.exist?
  #eq false, (@dir+"test").exist?
end
test_config() click to toggle source
# File vendor/qwik/lib/qwik/act-config.rb, line 46
def test_config
end
test_go_login() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 307
def test_go_login
  res = session('/test/') {|req|
    req.cookies.clear
  }
  ok_title 'Login'
  ok_xp [:meta, {:content=>'1; url=/test/.login',
      'http-equiv'=>'Refresh'}], '//meta[2]'

  t_with_path {
    res = session('/test/') {|req|
      req.cookies.clear
    }
    ok_title 'Login'
    ok_xp [:meta, {:content=>'1; url=/qwik/test/.login',
        'http-equiv'=>'Refresh'}], '//meta[2]'
  }
end
test_keywords() click to toggle source
# File vendor/qwik/lib/qwik/act-keywords.rb, line 114
    def test_keywords
      c = Qwik::Action
#      eq ["あ"], c.nodes_get("あ")
#      eq ["これ", "は", "テスト", "です", "。"],
#       c.nodes_get("これはテストです。")
#      eq ["今日", "も", "し", "ない", "と", "ね"],
#       c.nodes_get("今日もしないとね")
#      eq ["太郎", "は", "この", "本", "を", "二郎", "を", "見", "た",
#       "女性", "に", "渡し", "た", "。"],
#       c.nodes_get("太郎はこの本を二郎を見た女性に渡した。")
    end
test_nonexistent_action() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 279
def test_nonexistent_action
  t_add_user
  res = session '/test/.nosuch'
  ok_title 'no such action : nosuch'
end
test_nonexistent_ext() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 285
def test_nonexistent_ext
  t_add_user
  res = session '/test/1.nosuch'
  ok_title "No such file"
end
test_nonexistent_site() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 264
def test_nonexistent_site
  res = session '/nosuchsite/'
  ok_title 'No such site.'
  assert_text 'No such site.', 'h1'
  assert_text 'nosuchsite', 'b'
  eq 404, @res.status
end
test_plg_keywords() click to toggle source
# File vendor/qwik/lib/qwik/act-keywords.rb, line 126
def test_plg_keywords
  return unless $have_mecab

  page = @site.create('2')
  page.store("字")

  ok_wi [:div, {:class=>"keywords"},
    [:a, {:style=>"font-size:12.00px;", :href=>"%8E%9A.search"}, "字"]],
    "{{keywords(2)}}"
end
test_private_site() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 272
def test_private_site
  res = session '/test/'
  ok_title 'Members Only'
  ok_xp [:p, 'You are now logged in with this user id.', [:br],
    [:strong, 'user@e.com']],'//p'
end
test_redirect() click to toggle source
# File vendor/qwik/lib/qwik/action.rb, line 291
def test_redirect
  res = session '/test'
  ok_title 'redirect to site : test'
  ok_xp [:meta, {:content=>'0; url=/test/',
      'http-equiv'=>'Refresh'}], '//meta[2]'
end