class TestActBackup

Public Instance Methods

test_act_backup2() click to toggle source
# File vendor/qwik/lib/qwik/act-backup.rb, line 154
    def test_act_backup2
      #return if $0 != __FILE__

      # Only members can see the page.
      res = session '/test/1.html'
      ok_title 'Members Only'
      res = session '/test/1.backup'
      ok_title 'Members Only'

      t_add_user

      # You can see backup page even if the page does not exist.
      res = session '/test/1.html'
      ok_title 'Page not found.'
      res = session '/test/1.backup'
      ok_in ['Backup list'], '//title'

      page = @site.create_new
      page.put_with_time('t', 0)

      res = session '/test/1.html'
      ok_title '1'
      res = session '/test/1.backup'
      ok_in ['Backup list'], '//title'

      # Error check.
      res = session '/test/1.backup/0'
      ok_title 'Incorrect path arguments.'
      res = session '/test/1.100.200.backup'
      ok_title 'only one time stamp'
      res = session '/test/1.hoge.backup'
      ok_title 'should be number'

      list = @action.backup_list(@site, '1')
#      eq 't', list[0][0]
#      eq '',  list[1][0]
      eq nil, list[2]

      t1 = list[0][1]
      res = session "/test/1.#{t1}.backup"
      assert_text(/\A1 @ /, 'title')
      assert_text 't', 'pre'

      # Edit the page again.
      page.put_with_time 't2', 1

      list = @action.backup_list(@site, '1')
#      eq 't',  list[0][0]
#      eq 't2', list[1][0]
#      eq '',   list[2][0]
      eq nil,  list[3]

      diff = @action.backup_diff(list, 0, 1)
#      eq [[:del, 't'], [:br], [:ins, 't2'], [:br]], diff

      t2 = list[1][1]
      res = session "/test/1.#{t2}.backup"
      assert_text(/\A1 @ /, 'title')
      assert_text('t2', 'pre')
#      ok_in [[:del, 't'], [:br], [:ins, 't2'], [:br]],
#       "//div[@class='differ']"

      # Edit the page again. The 3rd times.
      page.put_with_time('t3', 2)

      list = @action.backup_list(@site, '1')
#      eq 't',  list[0][0]
#      eq 't2', list[1][0]
#      eq 't3', list[2][0]
#      eq '',   list[3][0]
      eq nil,  list[4]

      diff = @action.backup_diff(list, 1, 2)
#      eq [[:del, 't2'], [:br], [:ins, 't3'], [:br]], diff

      t3 = list[2][1]
      res = session "/test/1.#{t3}.backup"
      assert_text 't3', 'pre'
#      ok_in [[:del, 't2'], [:br], [:ins, 't3'], [:br]],
#               "//div[@class='differ']"
    end
test_plg_backup_list() click to toggle source
# File vendor/qwik/lib/qwik/act-backup.rb, line 148
def test_plg_backup_list
  ok_wi [:span, {:class=>'attribute'},
    [:a, {:href=>'1.backup'}, 'Show backup']],
    '{{backup_list}}'
end