Check response body instead of assigns in shares controller spec

This commit is contained in:
Matt Jankowski 2024-04-30 11:38:45 -04:00
parent 6167894547
commit d627957b50
1 changed files with 6 additions and 3 deletions

View File

@ -10,13 +10,16 @@ describe SharesController do
before { sign_in user }
describe 'GET #show' do
subject(:body_classes) { assigns(:body_classes) }
before { get :show, params: { title: 'test title', text: 'test text', url: 'url1 url2' } }
it 'returns http success' do
expect(response).to have_http_status 200
expect(body_classes).to eq 'modal-layout compose-standalone'
expect(body_class_values)
.to include('modal-layout', 'compose-standalone')
end
def body_class_values
Nokogiri::Slop(response.body).css('body').first.classes
end
end
end