require 'spec_helper' describe FBO::Parser::CombinedSolicitationHandler do let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "combine") } let(:file) { File.new(filename) } let(:contents) { file.read } subject { FBO::Parser::CombinedSolicitationHandler } it "should recognize combined solicitation content" do subject.is_combined_solicitation?(contents).should be_true end it "should parse all fields correctly" do combine = subject.parse(contents) combine.date.strftime("%Y-%m-%d").should eq Date.parse("2013-04-07").strftime("%Y-%m-%d") combine.year.should eq 2013 combine.agency.should eq "Defense Logistics Agency" combine.office.should eq "DLA Acquisition Locations" combine.location.should eq "DLA Aviation - BSM" combine.zip.should eq "23297" combine.class_code.should eq "61" combine.naics_code.should eq "335931" combine.office_address.should eq "DLA AVIATION; 8000 JEFFERSON DAVIS HIGHWAY; RICHMOND VA 23297" combine.subject.should eq "61--CABLE ASSEMBLY,SPECIAL" combine.solicitation_number.should eq "SPE4A613TBW31" combine.response_date.strftime("%Y-%m-%d").should eq "2013-04-15" combine.archive_date.strftime("%Y-%m-%d").should eq "2013-05-15" combine.contact_info.should eq "Questions regarding this solicitation should be emailed to dibbsBSM@dla.mil" combine.description.should eq "Proposed procurement for NSN 6150012666487 CABLE ASSEMBLY,SPECIAL:\nLine 0001 Qty 40.00 UI EA Deliver To: W1BG DLA DISTRIBUTION By: 0189 DAYS ADOApproved sources are 56540 75A756180-9AUK; 76301 75A756180-9AUK.\nThe solicitation is an RFQ and will be available at the link provided in this notice. Hard copies of this solicitation are not available. Specifications, plans, or drawings are not available.\nAll responsible sources may submit a quote which, if timely received, shall be considered.\nQuotes must be submitted electronically." combine.link_url.should eq "https://www.fbo.gov/spg/DLA/J3/DSCR-BSM/SPE4A613TBW31/listing.html" combine.link_description.should eq "Link To Document" combine.setaside.should eq "Total Small Business" combine.pop_country.should eq "US" combine.pop_zip.should eq "20005-4026" combine.pop_address.should eq "Washington, DC 20005" end it "should return a CombinedSolicitation notice" do combine = subject.parse(contents) combine.should be_instance_of(FBO::Notices::CombinedSolicitation) end context "when not a combined solicitation" do let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "presol") } it "should not recognize other notice content" do subject.is_combined_solicitation?(contents).should_not be_true end end end