Sha256: 09939a6874917a0286afa9349267dbf402942bc8fc85529fd063d97b3cf074e7

Contents?: true

Size: 1.58 KB

Versions: 6

Compression:

Stored size: 1.58 KB

Contents

require 'spec_helper'

describe Daengine::ContentServiceProcessor do
  context "process_orderable" do
    before do
      FactoryGirl.create :digital_asset, sami_code: 'AA123'    
      FactoryGirl.create :digital_asset, sami_code: 'AA456'    
      ContentServiceResource.stub(:find_all).and_return(
        [OpenStruct.new(:samiCode => 'AA123', :orderable => 'true')])
      Daengine.configure(:assets_path => Dir.pwd+'/spec/mock_data',
                              :daengine_yml_file => Dir.pwd+'/spec/mock_data/daengine.yml',
                              :digital_assets_file_directory => Dir.pwd + '/spec/mock_data/')      
    end    
    it 'processes orderable digital assets' do  
      DigitalAsset.all.count.should == 2
      DigitalAsset.first.sami_code.should == 'AA123' 
      Daengine::ContentServiceProcessor.process_orderable
      DigitalAsset.first.sami_code.should == 'AA123' 
      DigitalAsset.first.orderable.should be
      DigitalAsset.last.orderable.should_not be
    end
    it 'check orderable flag' do
    # process bulk deploy file in the mock dir
      DigitalAsset.delete_all
      file = File.expand_path('./spec/mock_data/bulk-ssc_deploy.xml')
      open_file = open(file, 'rb')
      Daengine::TeamsiteMetadataParser.parse_tuple_file(open_file,'2011-09-04 11:59:47 -0600')
      result = DigitalAsset.all
      result.each{ |da| da.update_attribute(:orderable,true)}
      Daengine::TeamsiteMetadataParser.parse_tuple_file(open_file,'2011-09-04 11:59:47 -0600')
      DigitalAsset.first.orderable.should be true
      DigitalAsset.last.orderable.should be true
    end        
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
daengine-0.5.10 spec/lib/content_service_processor_spec.rb
daengine-0.5.8 spec/lib/content_service_processor_spec.rb
daengine-0.5.7 spec/lib/content_service_processor_spec.rb
daengine-0.5.2 spec/lib/content_service_processor_spec.rb
daengine-0.5.1 spec/lib/content_service_processor_spec.rb
daengine-0.5.0 spec/lib/content_service_processor_spec.rb