Last active
April 6, 2022 15:05
-
-
Save stevo/6d27017232310db14bf88320ea722913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RSpec.describe BookingsController do | |
describe '#index' do | |
it 'renders all bookings' do | |
bookings = create_list(: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