require 'timecop' require 'eolclub_scraper/event_parser' describe EolclubScraper::EventParser do describe '#parse' do let(:parsed) { subject.parse(content) } let(:timezone_offset) { 5 * 60 * 60 } it 'parses an Event from the supplied content' do Timecop.freeze(Time.local(2013, 12, 28)) do expect( parsed.start_time ).to eq( Time.utc(2014, 1, 13, 18, 0, 0) + timezone_offset ) expect( parsed.end_time ).to eq( Time.utc(2014, 1, 13, 23, 0, 0) + timezone_offset ) end end it 'provides the HTML description from the scraped page' do desc = parsed.description expect(desc).to include("Monthly Providence, RI hacknight.") expect(desc).to match(/The next.*EOL Club.*meetup is/m) expect(desc).to include("@EOLclub") end end let(:content) { <<-EOF End of Line Club // Providence, RI hacknight

End of Line Club

Monthly Providence, RI hacknight. Code, design, and collaborate with other local developers to a backdrop of electronic music. Bring your laptop and a project to work on.

The next EOL Club meetup is Monday, January 13th from 6pm11pm at Basics Group. Arrive whenever you can. Food and beer provided.

@EOLclub to get more info and RSVP.

EOF } end