spec/unit/extractor_spec.rb in ddr-extraction-0.2.1 vs spec/unit/extractor_spec.rb in ddr-extraction-0.3.0

- old
+ new

@@ -1,19 +1,21 @@ module Ddr module Extraction RSpec.describe Extractor do describe "extracting text" do - let(:file) { File.expand_path("../../fixtures/sample.docx", __FILE__) } + subject { described_class.build(:tika) } + let(:file_path) { File.expand_path("../../fixtures/sample.docx", __FILE__) } it "should extract the text content of the file" do - expect(subject.extract(:text, file).read).to match(/This is a sample document./) + expect(subject.extract(:text, file_path).read).to match(/This is a sample document./) end end describe "extracting metadata" do - let(:file) { File.expand_path("../../fixtures/blue-devil.png", __FILE__) } + subject { described_class.build(:tika) } + let(:file_path) { File.expand_path("../../fixtures/blue-devil.png", __FILE__) } it "should extract technical metadata from the file" do - expect(subject.extract(:metadata, file).read.length).to_not eq(0) + expect(subject.extract(:metadata, file_path).read.length).to_not eq(0) end end end end