I want to mock one line from my endpoint:
InquiryProcessFilters::CompanyName.new(params[:filters][:company_name].downcase).call
So I've mock:
let(:company_name_filter_mock) { instance_double(InquiryProcessFilters::CompanyName) }
before do
allow(InquiryProcessFilters::CompanyName).to(receive(:new).and_return(company_name_filter_mock))
allow(company_name_filter_mock).to receive(:call).and_return(second_inquiry_process)
end
The problem is that my class from endpoint returns result as ActiveRecord_Relation
and this is my desired result. How to update my mock to achieve that?