Module: Livery::RSpec::Helper

Defined in:
lib/livery/rspec/helper.rb

Instance Method Summary collapse

Instance Method Details

#presenter_receives_instance_doubles!Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/livery/rspec/helper.rb', line 4

def presenter_receives_instance_doubles!
  before(:each) do
    allow(Livery::Presenter).to receive(:to_presenter_single) do |obj, namespace: nil|
      next nil unless obj

      klass = obj.instance_variable_get(:@doubled_module).target
      Livery::Presenter.presenterize(klass, namespace: namespace).new(obj)
    end
  end
end