From 33862bab25650de2074720b01dbb86423a0b64d9 Mon Sep 17 00:00:00 2001 From: Luis Castro Date: Sun, 14 Jul 2019 11:25:00 +0200 Subject: [PATCH] test(support): fix any_instance deprecation warning Changed from the old syntax to the new allow_any_instance_of according to the documentation. https://www.rubydoc.info/github/rspec/rspec-mocks/RSpec/Mocks/ExampleMethods%3aallow_any_instance_of --- spec/lib/update/update_tickets_spec.rb | 2 +- spec/support/contexts/shared_donation_charge_context.rb | 6 +++--- spec/support/contexts/shared_rd_donation_value_context.rb | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/lib/update/update_tickets_spec.rb b/spec/lib/update/update_tickets_spec.rb index 7c8df4e1..da844a6e 100644 --- a/spec/lib/update/update_tickets_spec.rb +++ b/spec/lib/update/update_tickets_spec.rb @@ -5,7 +5,7 @@ describe UpdateTickets do let(:ticket) { - Event.any_instance.stub(:geocode).and_return([1,1]) + allow_any_instance_of(Event).to receive(:geocode).and_return([1,1]) create(:ticket, :has_card, :has_event) } diff --git a/spec/support/contexts/shared_donation_charge_context.rb b/spec/support/contexts/shared_donation_charge_context.rb index 2e0d2a63..1e2d1037 100644 --- a/spec/support/contexts/shared_donation_charge_context.rb +++ b/spec/support/contexts/shared_donation_charge_context.rb @@ -17,11 +17,11 @@ RSpec.shared_context :shared_donation_charge_context do let(:campaign) {force_create(:campaign, nonprofit: nonprofit, goal_amount: 500)} let(:other_campaign) {force_create(:campaign, nonprofit: other_nonprofit)} let(:event) { - Event.any_instance.stub(:geocode).and_return([1,1]) + allow_any_instance_of(Event).to receive(:geocode).and_return([1,1]) force_create(:event, nonprofit: nonprofit) } let(:other_event) { - Event.any_instance.stub(:geocode).and_return([1,1]) + allow_any_instance_of(Event).to receive(:geocode).and_return([1,1]) force_create(:event, nonprofit: other_nonprofit) } let(:event_discount) {force_create(:event_discount, event: event, percent: 20)} @@ -46,4 +46,4 @@ RSpec.shared_context :shared_donation_charge_context do StripeMock.stop end } -end \ No newline at end of file +end diff --git a/spec/support/contexts/shared_rd_donation_value_context.rb b/spec/support/contexts/shared_rd_donation_value_context.rb index 8a30d2c5..a8889e82 100644 --- a/spec/support/contexts/shared_rd_donation_value_context.rb +++ b/spec/support/contexts/shared_rd_donation_value_context.rb @@ -19,7 +19,7 @@ RSpec.shared_context :shared_rd_donation_value_context do let(:default_edit_token) {'7903e34c-10fe-11e8-9ead-d302c690bee4'} before(:each){ - allow_any_instance_of(Event).to_receive(:geocode).and_return([1,1]) + allow_any_instance_of(Event).to receive(:geocode).and_return([1,1]) }