Skip to content

Commit

Permalink
Fix errors under Ruby 1.8.7. Use Ja/Nein instead of false/true
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Sep 23, 2013
1 parent 37e5d15 commit a2cfbeb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/brand2csv.rb
Expand Up @@ -313,7 +313,7 @@ def Swissreg::getMarkenInfoFromDetail(doc)
bezeichnung = nil
inhaber = nil
hinterlegungsdatum = nil
hatVertreter = false
hatVertreter = 'Nein'
doc.xpath("//html/body/form/div/div/fieldset/div/table/tbody/tr").each{
|x|
if x.children.first.text.eql?('Marke')
Expand All @@ -330,7 +330,7 @@ def Swissreg::getMarkenInfoFromDetail(doc)
end

if x.children.first.text.eql?('Vertreter/in')
hatVertreter = true if x.children[1].text.length > 0
hatVertreter = 'Ja' if x.children[1].text.length > 0
end
hinterlegungsdatum = x.children[1].text if x.children.first.text.eql?('Hinterlegungsdatum')
number = x.children[1].text if x.children.first.text.eql?('Gesuch Nr.')
Expand Down
2 changes: 1 addition & 1 deletion spec/csv_spec.rb
Expand Up @@ -20,7 +20,7 @@
Swissreg::emitCsv(results, file.path)
inhalte = IO.readlines(file.path)
inhalte[0].chomp.should == 'name;markennummer;inhaber;land;hatVertreter;hinterlegungsdatum;zeile_1;zeile_2;zeile_3;zeile_4;zeile_5;plz;ort'
inhalte[1].chomp.should == 'https://www.swissreg.ch/srclient/images/loadImage?Action=LoadImg&ItemType=tm&ImageType=print&ImageHash=F431E13A9D8F363BD06604796634142A18A5BA7C.jpeg;00135/2013;Peter Löcker Bauart, Trollstrasse 20, 8400 Winterthur;Schweiz;false;13.03.2013;Peter Löcker Bauart;Trollstrasse 20;;;;8400;Winterthur'
inhalte[1].chomp.should == 'https://www.swissreg.ch/srclient/images/loadImage?Action=LoadImg&ItemType=tm&ImageType=print&ImageHash=F431E13A9D8F363BD06604796634142A18A5BA7C.jpeg;00135/2013;Peter Löcker Bauart, Trollstrasse 20, 8400 Winterthur;Schweiz;Nein;13.03.2013;Peter Löcker Bauart;Trollstrasse 20;;;;8400;Winterthur'
inhalte[2].should == nil
end

Expand Down
8 changes: 4 additions & 4 deletions spec/swissreg_spec.rb
Expand Up @@ -18,9 +18,9 @@
results[0].ort.should == 'Zürich'
csv = "#{timespan}.csv"
csv_lines = IO.readlines(csv)
csv_lines[1].split(';')[HasVertreterPos].should == "true"
csv_lines[2].split(';')[HasVertreterPos].should == "true"
csv_lines[3].split(';')[HasVertreterPos].should == "false"
csv_lines[1].split(';')[HasVertreterPos].should == "Ja"
csv_lines[2].split(';')[HasVertreterPos].should == "Ja"
csv_lines[3].split(';')[HasVertreterPos].should == "Nein"
end

it "should get correct results from swissreg when owner has two postal addresses" do
Expand All @@ -38,7 +38,7 @@
csv = "#{timespan}.csv"
csv_lines = IO.readlines(csv)
csv_lines[1].split(';')[2].should == 'Philipp Arnold, Seestrasse 37a, 6454 Flüelen'
csv_lines[1].split(';')[HasVertreterPos].should == "true"
csv_lines[1].split(';')[HasVertreterPos].should == "Ja"
end

end

0 comments on commit a2cfbeb

Please sign in to comment.