Module: NextInstanceOf

Defined in:
lib/spree/testing_support/next_instance_of.rb

Overview

Helper services with prepended ServiceModule gitlab.com/gitlab-org/gitlab-foss/-/issues/33587

ex: expect_next_instance_of(service_class) do |instance|

expect(instance).to receive(:call)

end

Instance Method Summary collapse

Instance Method Details

#allow_next_instance_of(klass, *new_args) ⇒ Object



16
17
18
19
20
# File 'lib/spree/testing_support/next_instance_of.rb', line 16

def allow_next_instance_of(klass, *new_args)
  stub_new(allow(klass), *new_args) do |allowance|
    yield(allowance)
  end
end

#expect_next_instance_of(klass, *new_args) ⇒ Object



10
11
12
13
14
# File 'lib/spree/testing_support/next_instance_of.rb', line 10

def expect_next_instance_of(klass, *new_args)
  stub_new(expect(klass), *new_args) do |expectation|
    yield(expectation)
  end
end