mocking
This commit is contained in:
parent
a272b22208
commit
c1c045a4cd
4 changed files with 15 additions and 13 deletions
|
|
@ -35,7 +35,7 @@ class EMWebfinger
|
||||||
if profile_url
|
if profile_url
|
||||||
get_webfinger_profile(profile_url)
|
get_webfinger_profile(profile_url)
|
||||||
else
|
else
|
||||||
process_callbacks "webfinger does not seem to be enabled for #{@account}"
|
process_callbacks "webfinger does not seem to be enabled for #{@account}'s host"
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ describe EMWebfinger do
|
||||||
n = EMWebfinger.new("foo@example.com")
|
n = EMWebfinger.new("foo@example.com")
|
||||||
|
|
||||||
n.on_person{|person|
|
n.on_person{|person|
|
||||||
person.should == "webfinger does not seem to be enabled for #{fake_account}"
|
person.should == "webfinger does not seem to be enabled for #{fake_account}'s host"
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -107,7 +107,7 @@ describe EMWebfinger do
|
||||||
|
|
||||||
context 'webfingering local people' do
|
context 'webfingering local people' do
|
||||||
it 'should return a person from the database if it matches its handle' do
|
it 'should return a person from the database if it matches its handle' do
|
||||||
person
|
person.save
|
||||||
EM.run do
|
EM.run do
|
||||||
finger.on_person { |p|
|
finger.on_person { |p|
|
||||||
p.should == person
|
p.should == person
|
||||||
|
|
|
||||||
|
|
@ -25,14 +25,6 @@ describe Diaspora::UserModules::Friending do
|
||||||
Notifier.stub!(:request_accepted).and_return(deliverable)
|
Notifier.stub!(:request_accepted).and_return(deliverable)
|
||||||
end
|
end
|
||||||
|
|
||||||
before :all do
|
|
||||||
User.any_instance.stubs(:push_to_people)
|
|
||||||
end
|
|
||||||
|
|
||||||
after :all do
|
|
||||||
unstub_mocha_stubs
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#contact_for' do
|
describe '#contact_for' do
|
||||||
|
|
||||||
it 'returns a contact' do
|
it 'returns a contact' do
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,9 @@ RSpec.configure do |config|
|
||||||
|
|
||||||
config.before(:each) do
|
config.before(:each) do
|
||||||
stub_sockets
|
stub_sockets
|
||||||
EventMachine::HttpRequest.any_instance.stubs(:new).returns(FakeHttpRequest.new(:success))
|
EventMachine::HttpRequest.stub!(:new).and_return(FakeHttpRequest.new(:success))
|
||||||
|
EventMachine::HttpRequest.any_instance.stubs(:post)
|
||||||
|
EventMachine::HttpRequest.any_instance.stubs(:get)
|
||||||
DatabaseCleaner.clean
|
DatabaseCleaner.clean
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
@ -51,10 +53,18 @@ class FakeHttpRequest
|
||||||
@callbacks.pop unless @callbacks.nil? || @callbacks.empty?
|
@callbacks.pop unless @callbacks.nil? || @callbacks.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def response_header
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
|
def method_missing(method)
|
||||||
|
self
|
||||||
|
end
|
||||||
|
|
||||||
def post(opts = nil);
|
def post(opts = nil);
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
||||||
def get(opts = nil)
|
def get(opts = nil)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue