From 4a02eab2379acd86874702e7cd812bc05be943ab Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 Apr 2024 13:10:25 -0400 Subject: [PATCH] Check response body instead of assigns in admin accounts controller spec --- spec/controllers/admin/accounts_controller_spec.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index b90bb414b0..34de343db4 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -40,15 +40,16 @@ RSpec.describe Admin::AccountsController do expect(response) .to have_http_status(200) - expect(assigns(:accounts)) - .to have_attributes( - count: eq(1), - klass: be(Account) - ) + expect(accounts_table_rows.size) + .to eq(1) expect(AccountFilter) .to have_received(:new) .with(hash_including(params)) end + + def accounts_table_rows + Nokogiri::Slop(response.body).css('table.accounts-table tr') + end end describe 'GET #show' do