Sha256: 0555d8270b1b9788bed94a0eb41152d542f7f366bf33c5831d20e76e6719c5b9

Contents?: true

Size: 1.42 KB

Versions: 4

Compression:

Stored size: 1.42 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 => 'swf', :type => 'application/x-shockwave-flash' } ].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 rb rhtml ].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

4 entries across 4 versions & 1 rubygems

Version Path
heel-3.2.1 spec/directory_indexer_spec.rb
heel-3.2.0 spec/directory_indexer_spec.rb
heel-3.1.3 spec/directory_indexer_spec.rb
heel-3.1.2 spec/directory_indexer_spec.rb