require_relative 'helper'
require 'css_inliner'

class CSSInlinerTest < Test::Unit::TestCase
  def setup
    @fixtures_dir = File.join(File.dirname(__FILE__), 'fixtures')
  end

  def test_process_without_inline_style
    basedir = File.join(@fixtures_dir, 'sample1')
    assert_equal *process(basedir)
  end

  def test_process_with_inline_style
    basedir = File.join(@fixtures_dir, 'sample2')
    assert_equal *process(basedir)
  end

  def process(basedir)
    source = File.read(File.join(basedir, 'index.html'))
    inlined = File.read(File.join(basedir, 'index.inlined.html'))
    [inlined, CSSInliner.process(source, basedir)]
  end
end

require_relative 'helper'
require 'css_inliner'

class CSSInlinerTest < CSSInlinerTestCase
  def setup
    super
  end

  def test_process_without_inline_style
    assert_equal *process(@sample1_dir)
  end

  def test_process_with_inline_style
    assert_equal *process(@sample2_dir)
  end

  def process(basedir)
    source = File.read(File.join(basedir, 'index.html'))
    inlined = File.read(File.join(basedir, 'index.inlined.html'))
    [inlined, CSSInliner.process(source, basedir)]
  end
end

Use instance vars defined on test/helper.rb
[REFACTOR] Use instance vars defined on test/helper.rb
