Sha256: b649afe618ee752fb5dbd7c3ac17721549a97b63f883b1aa06d0106925b0e308

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'minitest/autorun'

require 'compass'
require 'debugger'
require 'haml'
require 'redcarpet'
require 'sass'

require_relative '../lib/staticpress'

class TestCase < MiniTest::Spec
  TEST_BLOG = (Staticpress.root + '..' + 'tests' + 'test_blog').expand_path

  def setup
    Staticpress.blog_path = TEST_BLOG
  end

  def teardown
    Staticpress.blog_path = '.'
    test_blog_public = TEST_BLOG + 'public'
    FileUtils.rm_rf test_blog_public if test_blog_public.directory?
  end

  def env(path)
    {
      'REQUEST_PATH' => path
    }
  end

  def assert_eql(expected, actual, message = nil)
    assert actual.eql?(expected), (message || "Expected #{actual} to have same content as #{expected}")
  end

  def refute_raises(exception, &block)
    begin
      block.call
      assert true
    rescue Exception => e
      refute e.is_an?(exception), exception_details(e, "Expected #{e} not to be raised")
      raise e
    end
  end

  def with_config(options, &block)
    original = self.config

    begin
      self.config.merge(options).save
      block.call
    ensure
      original.save
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
staticpress-0.6.2 tests/test_case.rb
staticpress-0.6.1 tests/test_case.rb
staticpress-0.6.0 tests/test_case.rb