From 61d108f415bc4689c52f6d0ae693568f2f25ad97 Mon Sep 17 00:00:00 2001 From: Matt Jankowski <matt@jankowski.online> Date: Fri, 12 Apr 2024 05:50:46 -0400 Subject: [PATCH] Extract `header_tags` method in statuses/show view spec (#29907) --- spec/views/statuses/show.html.haml_spec.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/spec/views/statuses/show.html.haml_spec.rb b/spec/views/statuses/show.html.haml_spec.rb index 92ba678b6..c74377d98 100644 --- a/spec/views/statuses/show.html.haml_spec.rb +++ b/spec/views/statuses/show.html.haml_spec.rb @@ -21,12 +21,11 @@ describe 'statuses/show.html.haml', :without_verify_partial_doubles do render - header_tags = view.content_for(:header_tags) - - expect(header_tags).to match(/<meta content=".+" property="og:title">/) - expect(header_tags).to match(/<meta content="article" property="og:type">/) - expect(header_tags).to match(/<meta content=".+" property="og:image">/) - expect(header_tags).to match(%r{<meta content="http://.+" property="og:url">}) + expect(header_tags) + .to match(/<meta content=".+" property="og:title">/) + .and match(/<meta content="article" property="og:type">/) + .and match(/<meta content=".+" property="og:image">/) + .and match(%r{<meta content="http://.+" property="og:url">}) end it 'has twitter player tag' do @@ -40,9 +39,12 @@ describe 'statuses/show.html.haml', :without_verify_partial_doubles do render - header_tags = view.content_for(:header_tags) + expect(header_tags) + .to match(%r{<meta content="http://.+/media/.+/player" property="twitter:player">}) + .and match(/<meta content="player" property="twitter:card">/) + end - expect(header_tags).to match(%r{<meta content="http://.+/media/.+/player" property="twitter:player">}) - expect(header_tags).to match(/<meta content="player" property="twitter:card">/) + def header_tags + view.content_for(:header_tags) end end