require 'spec_helper' describe FBO::Parser::AwardHandler do let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "award") } let(:file) { File.new(filename) } let(:contents) { file.read } subject { FBO::Parser::AwardHandler } it "should recognize award content" do subject.is_award?(contents).should be_true end it "should parse all fields correctly" do award = subject.parse(contents) award.date.strftime("%Y-%m-%d").should eq Date.parse("2013-03-27").strftime("%Y-%m-%d") award.year.should eq 2013 award.agency.should eq "Department of the Army" award.office.should eq "Army Contracting Command, MICC" award.location.should eq "MICC - Fort Leonard Wood" award.zip.should eq "65473" award.class_code.should eq "Z" award.naics_code.should eq "238320" award.office_address.should eq "MICC - Fort Leonard Wood, Directorate of Contracting, P.O. Box 140, Fort Leonard Wood, MO 65473-0140" award.subject.should eq "Z--Painting and General Repairs Requirements for Fort Leonard Wood Military Installation and Lake of the Ozarks Recreation Area, Missouri." award.solicitation_number.should eq "W911S713B0002" award.notice_type.should eq "PRESOL" award.archive_date.strftime("%Y-%m-%d").should eq "2013-04-26" award.contact_info.should eq "Christine Wilson, 5735960251\n\nMICC - Fort Leonard Wood" award.description.should eq "Painting and General Repairs Requirements for Fort Leonard Wood Military Installation and Lake of the Ozarks Recreation Area, Missouri." award.award_number.should eq "W911S713D0003" award.award_amount.should eq 10_848_912.50 award.line_number.should eq "0001" award.awardee.should eq "HOWELL & HOWELL CONTRACTORS, INC. (601721483)
2603 GRASSLAND DR
LOUISVILLE, KY 40299-2523" award.awardee_duns.should eq "1234567890123" award.link_url.should eq "https://www.fbo.gov/notices/4f878388ec8ed40badf141d1c0281dae" award.link_description.should eq "Link To Document" award.email_address.should eq "christine.l.wilson2.civ@mail.mil" award.email_description.should eq "MICC - Fort Leonard Wood" award.setaside.should be_nil award.correction.should be_false end it "should return an Award notice" do award = subject.parse(contents) award.should be_instance_of(FBO::Notices::Award) end context "when not an award" do let(:filename) { File.join(File.dirname(__FILE__), "..", "..", "fixtures", "notices", "presol") } it "should not recognize other notice content" do subject.is_award?(contents).should_not be_true end end end