Sha256: 6f28220e585352bba4eb7e510fd390c61a802299c87bb84e87756018779aeb07

Contents?: true

Size: 1.34 KB

Versions: 5

Compression:

Stored size: 1.34 KB

Contents

require "helper"
require 'fileutils'

class TestAllFixtures < Test::Unit::TestCase
  @@root = File.join(Dir.pwd, 'test', 'fixtures')

  def setup
    @original_pwd = Dir.pwd
  end

  def teardown
    # Remove all the generated www's
    Dir["#{@@root}/**/www"].each do |match|
      FileUtils.rm_rf match
    end
    Dir.chdir @original_pwd
  end

  def self.all_sites
    @@sites ||= Dir["#{@@root}/*"] \
      .select { |f| File.directory? f } \
      .map    { |f| File.basename(f) }
  end

  all_sites.each do |site|
    describe "Test `#{site}`" do
      should "Build #{site} properly and have identical files to the control" do
        @project = Hyde::Project.new File.join(@@root, site)
        @project.build

        unknown_root = @project.root :output
        control_root = @project.root 'www_control'

        if not File.directory? control_root
          flunk "No www_control"
        else
          @project.files.reject { |f| File.directory? f }.each do |path|
            unknown_path = File.join(unknown_root, path)
            flunk "file #{unknown_path} doesn't exist" \
              unless File.exists?(unknown_path)

            unknown = File.open(File.join(unknown_root, path)).read
            control = File.open(File.join(control_root, path)).read

            assert_equal control, unknown
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
hydeweb-0.0.8.pre2 test/test_all_fixtures.rb
hydeweb-0.0.8.pre1 test/test_all_fixtures.rb
hydeweb-0.0.7 test/test_all_fixtures.rb
hydeweb-0.0.5 test/test_all_fixtures.rb
hydeweb-0.0.4 test/test_all_fixtures.rb