Stop disabling Send workers for each example
This commit is contained in:
parent
b447eb6e95
commit
8f46073809
3 changed files with 15 additions and 7 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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|
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue