This file is indexed.

/usr/share/doc/ruby-ramaze/examples/app/wikore/spec/wikore.rb is in ruby-ramaze 2012.12.08-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
require 'ramaze'
require 'ramaze/spec/bacon'

spec_requires 'hpricot', 'sequel'

$LOAD_PATH.unshift base = __DIR__('..')
require 'start'

describe 'Wikore' do
  behaves_like :rack_test

  def check_redirect(to = '/')
    response = yield
    response.status.should == 302
    response.body.should =~ /<a href='.*#{to}'>/
  end

  def page_should_exist(name, *matches)
    page = get("/#{name}")
    page.status.should == 200
    matches.each do |match|
      page.body.should =~ match
    end
  end

  it 'should have no Main page' do
    page = get('/Main')
    page.status.should == 200
    page.body.should =~ /No Page known as 'Main'/
  end

  it 'should create a Main page' do
    check_redirect '/Main' do
      post('/page/create', 'title' => 'Main', 'text' => 'Newly created Main page')
    end

    matches = [
      /Newly created Main page/,
      /Version: 1/
    ]
    page_should_exist('Main', *matches)
  end

  it 'should update Main page' do
    check_redirect '/Main' do
      post('/page/save', 'title' => 'Main', 'text' => 'Newly updated Main page')
    end

    matches = [
      /Newly updated Main page/,
      /Version: 2/
    ]
    page_should_exist('Main', *matches)
  end

  it 'should maintain a backup' do
    matches = [
      /Newly created Main page/,
      /Version: 1/
    ]
    page_should_exist('Main/1', *matches)
  end

  it 'should revert' do
    get('/page/revert/Main')

    matches = [
      /Newly created Main page/,
      /Version: 1/
    ]
    page_should_exist('Main', *matches)
  end


  it 'should incrememt version of Main page' do
    (2..4).each do |n|
      post('/page/save', 'title' => 'Main', 'text' => 'updated Main page')

      matches = [ /updated Main page/, /Version: #{n}/ ]
      page_should_exist('Main', *matches)
    end
  end

  it 'should rename Main page to Other and back' do
    check_redirect '/Other' do
      get('/page/rename/Main/Other')
    end
    check_redirect '/Main' do
      get('/page/rename/Other/Main')
    end
  end

  it 'should delete Main page' do
    get('/page/delete/Main')

    page_should_exist('Main', /No Page known as 'Main'/)
  end

  it 'should fail if create/save is not POSTed to' do
    check_redirect '/' do
      get('/page/save', 'title' => 'Main', 'text' => 'Newly updated Main page')
    end
    check_redirect '/' do
      get('/page/create', 'title' => 'Main', 'text' => 'Newly updated Main page')
    end
  end

  FileUtils.rm_f(DB_FILE)
end