diff --git a/lib/hcard.rb b/lib/hcard.rb index 5fd60b182..d02e2b4ec 100644 --- a/lib/hcard.rb +++ b/lib/hcard.rb @@ -3,10 +3,6 @@ # the COPYRIGHT file. module HCard - def self.fetch url - Nokogiri::HTML(Net::HTTP.get URI.parse(url)) - end - def self.parse doc { :given_name => doc.css(".given_name").text, @@ -16,10 +12,6 @@ module HCard } end - def self.find url - self.parse self.fetch(url) - end - def self.build(raw_hcard) self.parse Nokogiri::HTML(raw_hcard) end diff --git a/spec/lib/hcard_spec.rb b/spec/lib/hcard_spec.rb index 8c75466f5..7228a1893 100644 --- a/spec/lib/hcard_spec.rb +++ b/spec/lib/hcard_spec.rb @@ -6,10 +6,9 @@ require 'spec_helper' require File.join(Rails.root, 'lib/hcard') describe HCard do - it 'should retreive and parse an hcard' do - stub_success("tom@tom.joindiaspora.com") - f = Redfinger.finger('tom@tom.joindiaspora.com') - hcard = HCard.find f.hcard.first[:href] + it 'should parse an hcard' do + raw_hcard = hcard_response + hcard = HCard.build raw_hcard hcard[:family_name].include?("Hamiltom").should be true hcard[:given_name].include?("Alex").should be true hcard[:photo].include?("tom.jpg").should be true