Sha256: 60dab8a95fd696d6ae8fda518c35444ceca874cc4c6b2dea3fafc971340155c6

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

require 'rack/olelo_patches'
require 'olelo'
require 'bacon'
require 'rack/test'

module TestHelper
  def load_plugin(*plugins)
    Olelo.logger = Logger.new(File.expand_path(File.join(File.dirname(__FILE__), '..', 'test.log')))
    Olelo::Plugin.dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'plugins'))
    Olelo::Plugin.load(*plugins)
  end

  def create_repository
    Olelo::Repository.instance = nil
    Olelo::Config.instance['repository.type'] = 'git'
    Olelo::Config.instance['repository.git.path'] = File.expand_path(File.join(File.dirname(__FILE__), '.test'))
    Olelo::Config.instance['repository.git.bare'] = true
    load_plugin('repositories/git')
  end

  def destroy_repository
    Olelo::Repository.instance = nil
    FileUtils.rm_rf(Olelo::Config['repository.git.path'])
  end

  def create_page(name, content = 'content')
    Olelo::Page.transaction do
      page = Olelo::Page.new(name)
      page.content = content
      page.save
      Olelo::Page.commit('comment')
    end
  end
end

class Bacon::Context
  include TestHelper
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
olelo-0.9.3 test/helper.rb
olelo-0.9.2 test/helper.rb
olelo-0.9.1 test/helper.rb
olelo-0.9.0 test/helper.rb