Sha256: 7a60a4cf163e9915b97e5c90d0fa5a38473143f5d405270fbc9b1ccf341f0b55

Contents?: true

Size: 1.24 KB

Versions: 1

Compression:

Stored size: 1.24 KB

Contents

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

describe "PlainTextExtractors" do
  before(:all) do
    Indexer.ensure_index_existence
  end

  PlainTextExtractor.all.each{|extractor|
    extractor.exts.each{|ext|
      should_extract= "should be able to extract content from #{extractor.description} (.#{ext})"
      content_and_file_examples_for_this_ext=extractor.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 extractor in lib/extractors:
        # 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

1 entries across 1 versions & 1 rubygems

Version Path
picolena-0.1.7 lib/picolena/templates/spec/models/plain_text_extractor_spec.rb