Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class BookingsController < ApplicationController
def index
# `order` was added prematurely and in the result may remain untested
bookings = Booking.order(customer_name: :asc)
render :index, locals: { bookings: bookings }
end
end
RSpec.describe BookingsController do
describe '#index' do
it 'renders all bookings' do
bookings = create(:booking, 5)
allow(controller).to receive(:render).and_call_original
get :index
expect(controller).to have_received(:render).
with(:index, locals: { bookings: match_array(bookings) })
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.