-
Notifications
You must be signed in to change notification settings - Fork 140
Open
Description
Currently RSpec::Sidekiq::NullObject is defined like so
# lib/rspec/sidekiq/batch.rb:7-13
module RSpec
module Sidekiq
class NullObject
def method_missing(*args, &block)
self
end
end
end
endbut when overriding #method_missing, #respond_to_missing? should be overridden too.
Current implementation leads to a bug when using delegation.
# spec/rspec_sidekiq_null_batch_spec.rb
require "rails_helper"
class SidekiqBatchEssentially < SimpleDelegator
end
RSpec.describe "Delegation error, issue 274" do
it "delegation works" do
batch = SidekiqBatchEssentially.new(Sidekiq::Batch.new)
expect do
batch.callback_queue = "should_not_fail"
batch.callback_queue
end.not_to raise_error
end
endSuggested fix:
# lib/rspec/sidekiq/batch.rb:1-17
# frozen_string_literal: true
require "rspec/core"
require "rspec/support/fuzzy_matcher"
if defined? Sidekiq::Batch
module RSpec
module Sidekiq
class NullObject
def method_missing(*args, &block)
self
end
def respond_to_missing?(*_args)
true
end
end
# ...Vadim-Kurnatovskiy
Metadata
Metadata
Assignees
Labels
No labels