Sha256: 373534ec8284ce29946b17c2692cbb4ac97dee9abbc783807b76b7c9cd38f567

Contents?: true

Size: 1.11 KB

Versions: 101

Compression:

Stored size: 1.11 KB

Contents

require 'spec_helper'

describe Daengine::TaxonomyProcessor do
  before { Daengine.configure(:taxonomy_xml_filepath => Dir.pwd+'/spec/mock_data/taxonomy/taxonomy.xml',
                              :taxonomyengine_yml_file => Dir.pwd+'/spec/mock_data/taxonomy/taxonomyengine.yml'
  ) }
  context "process_taxonomy_file" do
    it 'processes only files modified in the last 2 days' do
      # process bulk deploy file in the mock dir
        TaxonomyTerm.destroy_all
        before = TaxonomyTerm.count
        FileUtils.touch Dir.pwd+'/spec/mock_data/taxonomy/taxonomy.xml'
        before = TaxonomyTerm.count
        Daengine::TaxonomyProcessor.process_taxonomy_file
        after = TaxonomyTerm.count
        (after - before).should == 1057
    end
    it 'processes only those files that modified since the last time the daengine taxonomy process ran' do
      # process any files that has modified since last run. None !!
        before = TaxonomyTerm.count
        Daengine::TaxonomyProcessor.process_taxonomy_file
        after = TaxonomyTerm.count
        (after - before).should == 0
    end
  end
end

Version data entries

101 entries across 101 versions & 1 rubygems

Version Path
daengine-0.2.2 spec/lib/taxonomy_processor_spec.rb