Sha256: a8369505184037e031a07195e83acaac76a54decaad0c0fd917ea6fcf9ef96c4

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

require 'spec_helper'

describe Heel::DirectoryIndexer do
  before(:each) do
    @indexer = Heel::DirectoryIndexer.new(Heel::Configuration.data_path("listing.rhtml"), { :highlighting => true })
  end

  it "should ignore .htaccess files" do
    @indexer.options[:ignore_globs] = %w( *~ .htaccess . )
    _(@indexer.should_ignore?(".htaccess")).must_equal true
  end

  it "should not ignore .html files " do
    @indexer.options[:ignore_globs] = %w( *~ .htaccess . )
    _(@indexer.should_ignore?("something.html")).must_equal false
  end

  it "can tell if highlighting is to be performed" do
    _(@indexer).must_be :highlighting?
  end
  
  it "knows if the template should be reloaded on changes" do
    _(@indexer.reload_on_template_change?).must_equal false
  end
  
  it "uses icons" do
    _(@indexer.using_icons?).must_equal false
  end

  it "uses a mime map" do
    _(@indexer.mime_map).must_be_instance_of(Heel::MimeMap)
  end

  [
    { :ext => 'svg', :type => 'image/svg+xml' },
    { :ext => 'flv', :type => 'video/x-flv' },
    { :ext => 'rb', :type => 'text/plain' },
    { :ext => 'rhtml', :type => 'text/plain' }
  ].each do |m|
      it "finds #{m[:ext]} extension in the map as #{m[:type]}" do
        _(@indexer.mime_map.mime_type_of( "test.#{m[:ext]}" )).must_equal m[:type]
      end
    end

  %w[ md markdown rdoc ].each do |ext|
    it "finds #{ext} in the map as text/plain" do
      _(@indexer.mime_map.mime_type_of( "test.#{ext}" )).must_equal "text/plain"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heel-4.0.1 spec/directory_indexer_spec.rb