diff options
author | maxwell <maxwell@joindiaspora.com> | 2010-10-30 03:21:39 +0400 |
---|---|---|
committer | maxwell <maxwell@joindiaspora.com> | 2010-10-30 03:21:39 +0400 |
commit | c1c045a4cd5ad8406d1ee6b16058934cb23aa3ff (patch) | |
tree | 4fbd2ac44db0f21f55bff1295ca9d11f5ec447e3 | |
parent | a272b222082dbd14696f54e6b151ddb620b2a3ce (diff) |
mocking
-rw-r--r-- | lib/em-webfinger.rb | 2 | ||||
-rw-r--r-- | spec/lib/em-webfinger_spec.rb | 4 | ||||
-rw-r--r-- | spec/models/user/user_friending_spec.rb | 8 | ||||
-rw-r--r-- | spec/spec_helper.rb | 14 |
4 files changed, 15 insertions, 13 deletions
diff --git a/lib/em-webfinger.rb b/lib/em-webfinger.rb index 1224e8868..f5c4c6148 100644 --- a/lib/em-webfinger.rb +++ b/lib/em-webfinger.rb @@ -35,7 +35,7 @@ class EMWebfinger if profile_url get_webfinger_profile(profile_url) 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 } diff --git a/spec/lib/em-webfinger_spec.rb b/spec/lib/em-webfinger_spec.rb index a90ae457d..a0c56877f 100644 --- a/spec/lib/em-webfinger_spec.rb +++ b/spec/lib/em-webfinger_spec.rb @@ -67,7 +67,7 @@ describe EMWebfinger do n = EMWebfinger.new("foo@example.com") 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 @@ -107,7 +107,7 @@ describe EMWebfinger do context 'webfingering local people' do it 'should return a person from the database if it matches its handle' do - person + person.save EM.run do finger.on_person { |p| p.should == person diff --git a/spec/models/user/user_friending_spec.rb b/spec/models/user/user_friending_spec.rb index 816e3c36b..42a42423f 100644 --- a/spec/models/user/user_friending_spec.rb +++ b/spec/models/user/user_friending_spec.rb @@ -25,14 +25,6 @@ describe Diaspora::UserModules::Friending do Notifier.stub!(:request_accepted).and_return(deliverable) end - before :all do - User.any_instance.stubs(:push_to_people) - end - - after :all do - unstub_mocha_stubs - end - describe '#contact_for' do it 'returns a contact' do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 58e544a4c..f850393ee 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -29,7 +29,9 @@ RSpec.configure do |config| config.before(:each) do 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 end end @@ -51,10 +53,18 @@ class FakeHttpRequest @callbacks.pop unless @callbacks.nil? || @callbacks.empty? end + def response_header + self + end + + def method_missing(method) + self + end + def post(opts = nil); self end - + def get(opts = nil) self end |