Sha256: f53e5d4155d1c7be8b60888e95289c3275b3797c93cc1bcfd9af50c888fa4586

Contents?: true

Size: 1.59 KB

Versions: 7

Compression:

Stored size: 1.59 KB

Contents

ENV["RAILS_ENV"] = 'test'

require File.expand_path(File.join(File.dirname(__FILE__), "/../../comatose_harness/config/environment.rb"))

require 'test/unit'
require 'test_help'

class Test::Unit::TestCase

  self.fixture_path = File.expand_path( File.join(File.dirname(__FILE__), 'fixtures') )

  self.use_transactional_fixtures = true
  self.use_instantiated_fixtures  = false
  
  def setup
    Comatose.configure do |config|
      config.default_filter      = :textile
      config.default_processor   = :liquid
      config.authorization       = Proc.new { true }
      config.admin_authorization = Proc.new { true }
      config.admin_get_author    = Proc.new { request.env['REMOTE_ADDR'] }
      config.admin_get_root_page = Proc.new { ComatosePage.root }
    end
    TextFilters.default_filter = "Textile"
  end

  def create_page(options={})
    ComatosePage.create({ :title => 'Comatose Page', :author=>'test', :parent_id=>1 }.merge(options))
  end
  
  def comatose_page(sym)
    ComatosePage.find_by_slug(sym.to_s.dasherize)
  end
  
  def assert_difference(object, method = nil, difference = 1)
    initial_value = object.send(method)
    yield
    assert_equal initial_value + difference, object.send(method), "#{object}##{method}"
  end

  def assert_no_difference(object, method, &block)
    assert_difference object, method, 0, &block
  end



  class << self
    def should(behave,&block)
      method_name = "test_should_#{behave.gsub(' ', '_')}"
      if block
        define_method method_name, &block
      else
        puts ">>> Untested: #{name.sub(/Test$/,'')} should #{behave}"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
aslakjo-comatose-2.0.5.3 test/test_helper.rb
aslakjo-comatose-2.0.5.12 test/test_helper.rb
aslakjo-comatose-2.0.5.11 test/test_helper.rb
aslakjo-comatose-2.0.5.10 test/test_helper.rb
aslakjo-comatose-2.0.5.9 test/test_helper.rb
aslakjo-comatose-2.0.5.8 test/test_helper.rb
aslakjo-comatose-2.0.5.7 test/test_helper.rb