From 4edd824d3c896f5bb8dffac30729de3627202956 Mon Sep 17 00:00:00 2001 From: khall Date: Mon, 25 Aug 2014 13:34:27 -0700 Subject: [PATCH] No deprecation warnings, but one spec still fails (but only when I run all the specs, not when I run just the one spec) --- spec/controllers/registrations_controller_spec.rb | 2 +- spec/controllers/services_controller_spec.rb | 2 +- spec/integration/tag_people_spec.rb | 4 ++-- spec/models/post_spec.rb | 2 +- spec/models/user/connecting_spec.rb | 2 +- spec/workers/http_multi_spec.rb | 3 +-- 6 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/controllers/registrations_controller_spec.rb b/spec/controllers/registrations_controller_spec.rb index 2bc0ac92e..f70fad126 100644 --- a/spec/controllers/registrations_controller_spec.rb +++ b/spec/controllers/registrations_controller_spec.rb @@ -16,7 +16,7 @@ describe RegistrationsController, :type => :controller do :password_confirmation => "password" } } - Webfinger.stub_chain(:new, :fetch).and_return(FactoryGirl.create(:person)) + allow(Webfinger).to receive_message_chain(:new, :fetch).and_return(FactoryGirl.create(:person)) end describe '#check_registrations_open!' do diff --git a/spec/controllers/services_controller_spec.rb b/spec/controllers/services_controller_spec.rb index 89cbf8448..1dd5396c6 100644 --- a/spec/controllers/services_controller_spec.rb +++ b/spec/controllers/services_controller_spec.rb @@ -71,7 +71,7 @@ describe ServicesController, :type => :controller do let(:provider) { {'provider' => 'twitter'} } before do - access_token.stub_chain(:response, :header).and_return header + allow(access_token).to receive_message_chain(:response, :header).and_return header request.env['omniauth.auth'] = omniauth_auth.merge!( provider).merge!( extra ) end diff --git a/spec/integration/tag_people_spec.rb b/spec/integration/tag_people_spec.rb index cf4e2e186..86c86eb56 100644 --- a/spec/integration/tag_people_spec.rb +++ b/spec/integration/tag_people_spec.rb @@ -1,12 +1,12 @@ require 'spec_helper' -describe TagsController do +describe TagsController, :type => :request do describe 'will_paginate people on the tag page' do let(:people) { (1..2).map { FactoryGirl.create(:person) } } let(:tag) { "diaspora" } before do - Stream::Tag.any_instance.stub(people_per_page: 1) + allow_any_instance_of(Stream::Tag).to receive_messages(people_per_page: 1) expect(Person).to receive(:profile_tagged_with).with(/#{tag}/).twice.and_return(people) end diff --git a/spec/models/post_spec.rb b/spec/models/post_spec.rb index 14137d2a3..da641ff26 100644 --- a/spec/models/post_spec.rb +++ b/spec/models/post_spec.rb @@ -396,7 +396,7 @@ describe Post, :type => :model do end it "raises Diaspora::NonPublic for a non-existing id without a user" do - Post.stub where: double(includes: double(first: nil)) + allow(Post).to receive_messages where: double(includes: double(first: nil)) expect { Post.find_by_guid_or_id_with_user 123 }.to raise_error Diaspora::NonPublic diff --git a/spec/models/user/connecting_spec.rb b/spec/models/user/connecting_spec.rb index 1cfad5c14..155dff64b 100644 --- a/spec/models/user/connecting_spec.rb +++ b/spec/models/user/connecting_spec.rb @@ -84,7 +84,7 @@ describe User::Connecting, :type => :model do describe '#register_share_visibilities' do it 'creates post visibilites for up to 100 posts' do - Post.stub_chain(:where, :limit).and_return([FactoryGirl.create(:status_message)]) + allow(Post).to receive_message_chain(:where, :limit).and_return([FactoryGirl.create(:status_message)]) c = Contact.create!(:user_id => alice.id, :person_id => eve.person.id) expect{ alice.register_share_visibilities(c) diff --git a/spec/workers/http_multi_spec.rb b/spec/workers/http_multi_spec.rb index 05e70d2f2..594f107eb 100644 --- a/spec/workers/http_multi_spec.rb +++ b/spec/workers/http_multi_spec.rb @@ -132,8 +132,7 @@ describe Workers::HttpMulti do person.serialized_public_key = "-----BEGIN RSA PUBLIC KEY-----\nPsych!\n-----END RSA PUBLIC KEY-----" person.save - # Should be possible to drop when converting should_receive to expect(...).to - RSpec::Mocks.proxy_for(Salmon::EncryptedSlap).reset + allow(@salmon).to receive(:xml_for).and_call_original Typhoeus.stub(person.receive_url).and_return @response Typhoeus.stub(@people[1].receive_url).and_return @response