Sha256: a093140c485ecfa9f4d6eb96a15586741cb734d5b195fa747086934fedce9e39

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

require File.dirname(__FILE__) + '/../spec_helper'

describe "Filters" do
  before(:all) do
    Finder.ensure_that_index_exists_on_disk
  end  
  
  PlainText.filters.each{|filter|
    filter.exts.each{|ext|
      should_extract= "should be able to extract content from #{filter.description} (.#{ext})"
      content_and_file_examples_for_this_ext=filter.content_and_file_examples.select{|content,file| File.ext_as_sym(file)==ext}
      unless content_and_file_examples_for_this_ext.empty? then
        it should_extract do
          content_and_file_examples_for_this_ext.each{|content_example,file_example|
            finder=Finder.new(content_example)
            finder.execute!
            matching_documents=finder.matching_documents
            matching_documents_filenames=matching_documents.collect{|d| d.filename}
            matching_documents_filenames.should include(file_example)
          }
        end
      else
        ## It means that the spec for this extension file is "Not yet implemented"!
        ## add this line to the corresponding filter in lib/filters:
        # which_should_for_example_extract 'some content', :from => 'a file you could add in spec/test_dirs/indexed/'
        it should_extract
      end
    }
  }
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picolena-0.0.99 app_generators/picolena/templates/spec/models/filters_spec.rb
picolena-0.1.0 lib/picolena/templates/spec/models/filters_spec.rb
picolena-0.1.1 lib/picolena/templates/spec/models/filters_spec.rb