diff --git a/spec/controllers/jasmine_fixtures/streams_spec.rb b/spec/controllers/jasmine_fixtures/streams_spec.rb index 5447a5420..0e815439a 100644 --- a/spec/controllers/jasmine_fixtures/streams_spec.rb +++ b/spec/controllers/jasmine_fixtures/streams_spec.rb @@ -5,6 +5,7 @@ describe StreamsController, :type => :controller do describe '#multi' do before do + allow(Workers::SendPublic).to receive(:perform_async) sign_in alice, scope: :user end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d9389167a..493ee8b36 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -106,8 +106,6 @@ RSpec.configure do |config| I18n.locale = :en stub_request(:post, "https://pubsubhubbub.appspot.com/") $process_queue = false - allow(Workers::SendPublic).to receive(:perform_async) - allow(Workers::SendPrivate).to receive(:perform_async) end config.expect_with :rspec do |expect_config| diff --git a/spec/support/user_methods.rb b/spec/support/user_methods.rb index 9b5860809..48fec7aba 100644 --- a/spec/support/user_methods.rb +++ b/spec/support/user_methods.rb @@ -2,6 +2,8 @@ class User alias_method :share_with_original, :share_with def share_with(*args) + disable_send_workers + inlined_jobs do share_with_original(*args) end @@ -13,6 +15,8 @@ class User end def post(class_name, opts = {}) + disable_send_workers + inlined_jobs do aspects = self.aspects_from_ids(opts[:to]) @@ -22,11 +26,9 @@ class User self.aspects.reload dispatch_opts = { - url: Rails.application.routes.url_helpers.post_url( - p, - host: AppConfig.pod_uri.to_s - ), - to: opts[:to]} + url: Rails.application.routes.url_helpers.post_url(p, host: AppConfig.pod_uri.to_s), + to: opts[:to] + } dispatch_post(p, dispatch_opts) end unless opts[:created_at] @@ -40,4 +42,11 @@ class User def build_comment(options={}) Comment::Generator.new(self, options.delete(:post), options.delete(:text)).build(options) end + + def disable_send_workers + RSpec.current_example&.example_group_instance&.instance_eval do + allow(Workers::SendPrivate).to receive(:perform_async) + allow(Workers::SendPublic).to receive(:perform_async) + end + end end