textractor 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ module Textractor::ContentTypeDetector
3
3
  class Simple
4
4
 
5
5
  def self.content_type_for_path(path)
6
- case File.extname(path)
6
+ case File.extname(path.downcase)
7
7
  when /\.pdf$/
8
8
  'application/pdf'
9
9
  when /\.doc$/
@@ -1,3 +1,3 @@
1
1
  module Textractor
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
@@ -0,0 +1,30 @@
1
+ require 'spec_helper'
2
+
3
+ describe Textractor::ContentTypeDetector::Simple do
4
+
5
+ FILENAMES = [
6
+ [
7
+ "foo.pdf", "application/pdf",
8
+ "foo.doc", "application/msword",
9
+ "foo.docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
10
+ "foo.txt", "text/plain",
11
+ ]
12
+ ]
13
+
14
+ describe '.content_type_for_path' do
15
+ FILENAMES.each do |(filename, content_type)|
16
+ context "given #{filename}" do
17
+ it "returns #{content_type}" do
18
+ Textractor::ContentTypeDetector::Simple.content_type_for_path(filename).should == content_type
19
+ end
20
+ end
21
+
22
+ context "given #{filename}" do
23
+ it "returns #{content_type}" do
24
+ Textractor::ContentTypeDetector::Simple.content_type_for_path(filename.upcase).should == content_type
25
+ end
26
+ end
27
+ end
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textractor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 5
10
- version: 0.1.5
9
+ - 6
10
+ version: 0.1.6
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Guterl
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-07-20 00:00:00 -04:00
18
+ date: 2011-07-22 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -81,6 +81,7 @@ files:
81
81
  - lib/textractor/extractors/pdf_extractor.rb
82
82
  - lib/textractor/extractors/text_extractor.rb
83
83
  - lib/textractor/version.rb
84
+ - spec/content_type_detector/simple_spec.rb
84
85
  - spec/fixtures/document .doc
85
86
  - spec/fixtures/document .docx
86
87
  - spec/fixtures/document .pdf