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