diff --git a/lib/em-webfinger.rb b/lib/em-webfinger.rb index 6d2756a9a..6b3d82326 100644 --- a/lib/em-webfinger.rb +++ b/lib/em-webfinger.rb @@ -14,9 +14,6 @@ class EMWebfinger def fetch raise 'you need to set a callback before calling fetch' if @callbacks.empty? - query = /\A^#{Regexp.escape(@account.gsub('acct:', '').to_s)}\z/i - local_person = Person.first(:diaspora_handle => query) - person = Person.by_account_identifier(@account) if person process_callbacks person diff --git a/spec/lib/em-webfinger_spec.rb b/spec/lib/em-webfinger_spec.rb index cd4973b89..1211c3cda 100644 --- a/spec/lib/em-webfinger_spec.rb +++ b/spec/lib/em-webfinger_spec.rb @@ -28,10 +28,7 @@ describe EMWebfinger do let(:non_diaspora_hcard) {File.open(File.join(Rails.root, 'spec/fixtures/evan_hcard')).read} context 'setup' do -<<<<<<< HEAD -======= let(:action){ Proc.new{|person| puts person.inspect }} ->>>>>>> EM websocket cleanly merged with master. webfingering is now async describe '#intialize' do it 'sets account ' do @@ -40,32 +37,29 @@ describe EMWebfinger do end it 'should raise an error on an unresonable email' do -<<<<<<< HEAD proc{ EMWebfinger.new("joe.valid+email@my-address.com") }.should_not raise_error(RuntimeError, "Identifier is invalid") - end - it 'should not allow port numbers' do + it 'should not allow port numbers' do proc{ EMWebfinger.new('eviljoe@diaspora.local:3000') }.should raise_error(RuntimeError, "Identifier is invalid") end -======= - proc{EMWebfinger.new("asfadfasdf")}.should raise_error - end ->>>>>>> EM websocket cleanly merged with master. webfingering is now async + proc{EMWebfinger.new("asfadfasdf")}.should raise_error end + end - describe '#on_person' do - it 'should set a callback' do - n = EMWebfinger.new("mbs@gmail.com") - n.stub(:fetch).and_return(true) - n.on_person{|person| puts "foo"} - n.instance_variable_get(:@callbacks).count.should be 1 - end + describe '#on_person' do + it 'should set a callback' do + n = EMWebfinger.new("mbs@gmail.com") + n.stub(:fetch).and_return(true) + + n.on_person{|person| puts "foo"} + n.instance_variable_get(:@callbacks).count.should be 1 + end end describe '#fetch' do @@ -120,11 +114,6 @@ describe EMWebfinger do EM.stop } } - end -<<<<<<< HEAD -======= - ->>>>>>> EM websocket cleanly merged with master. webfingering is now async end end end diff --git a/spec/models/person_spec.rb b/spec/models/person_spec.rb index a1314281a..b2bfa0ab0 100644 --- a/spec/models/person_spec.rb +++ b/spec/models/person_spec.rb @@ -213,40 +213,10 @@ describe Person do f = Person.by_account_identifier("tom@tom.joindiaspora.com") f.should be nil end + end - describe '.local_by_account_identifier' do - it 'should find local users people' do - p = Person.local_by_account_identifier(user.diaspora_handle) - p.should == user.person - end - - - it 'identifier should be a valid email' do - pending "should check in the webfinger client" - stub_success("joe.valid+email@my-address.com") - Proc.new { - Person.by_account_identifier("joe.valid+email@my-address.com") - }.should_not raise_error(RuntimeError, "Identifier is invalid") - - stub_success("not_a_@valid_email") - Proc.new { - Person.by_account_identifer("not_a_@valid_email") - }.should raise_error(RuntimeError, "Identifier is invalid") - - end - - it 'should not accept a port number' do - pending "should check the webfinger client" - stub_success("eviljoe@diaspora.local:3000") - Proc.new { - Person.by_account_identifier('eviljoe@diaspora.local:3000') - }.should raise_error(RuntimeError, "Identifier is invalid") - end - - end - describe '.local_by_account_identifier' do it 'should find local users people' do p = Person.local_by_account_identifier(user.diaspora_handle)