Sha256: 500884013766a488a2afe8919c0e06c8aa0b1310c8cff750b75a2d1730dc5fe8
Contents?: true
Size: 1.22 KB
Versions: 1
Compression:
Stored size: 1.22 KB
Contents
# encoding: utf-8 require 'spec_helper' describe BikePOA::MapParser do include FixtureHelper context 'given a full map page' do let(:map_page) { fixture('full_page.html').unpack('C*').pack('U*') } # gambi pattern around encoding silliness let(:result) { subject.parse(map_page) } it 'extracts relevant lines out of a map page' do result.should have(40).stations end %w[id name address online status size available].each do |field| it "extracted data for #{field} in all entries" do result.map { |h| h.has_key? field }.should == [true] * 40 end end end context 'given a certain area of a map page' do let(:content) { <<EOF trash trash function criaPonto() { blabla } trash trash trash exibirEstacaMapa("-30.028658", "-51.226791", "img/icone-estacoes.gif", "Mercado, em frente ao chalé", "1", "A", "EO", "4", "12", "Rua Marechal Floriano, 66, entre a Rua Voluntários da Pátria e a Avenida Otávio Rocha"); function exibirEstacaMapa(trash, trash, trash); EOF } it 'extracts one relevant line containing a station' do result = subject.parse(content) result.should have(1).station result.first['name'].should == 'Mercado, em frente ao chalé' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bikepoa-tools-0.4.0 | spec/map_parser_spec.rb |