diff options
author | Nick Schonning <nschonni@gmail.com> | 2023-02-17 16:56:20 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-18 06:56:20 +0900 |
commit | 669f6d2c0af969268c76e389ed626bce0cc9f998 (patch) | |
tree | f22f0314ee6f7e348b3ead9c22b93cf0fcc6303c /spec/lib | |
parent | 593bb8ce99b31f85a1c8f9bfbe34bd87b079581c (diff) |
Run rubocop formatting except line length (#23632)
Diffstat (limited to 'spec/lib')
-rw-r--r-- | spec/lib/activitypub/activity/create_spec.rb | 1 | ||||
-rw-r--r-- | spec/lib/extractor_spec.rb | 8 | ||||
-rw-r--r-- | spec/lib/fast_ip_map_spec.rb | 2 | ||||
-rw-r--r-- | spec/lib/link_details_extractor_spec.rb | 124 |
4 files changed, 67 insertions, 68 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb index 1a25395fa..cd0f2df6e 100644 --- a/spec/lib/activitypub/activity/create_spec.rb +++ b/spec/lib/activitypub/activity/create_spec.rb @@ -408,7 +408,6 @@ RSpec.describe ActivityPub::Activity::Create do end end - context 'with media attachments with long description' do let(:object_json) do { diff --git a/spec/lib/extractor_spec.rb b/spec/lib/extractor_spec.rb index dba4bd0bb..9c9f5ef04 100644 --- a/spec/lib/extractor_spec.rb +++ b/spec/lib/extractor_spec.rb @@ -20,7 +20,7 @@ describe Extractor do text = '@screen_name' extracted = Extractor.extract_mentions_or_lists_with_indices(text) expect(extracted).to eq [ - { screen_name: 'screen_name', indices: [ 0, 12 ] } + { screen_name: 'screen_name', indices: [0, 12] } ] end @@ -44,19 +44,19 @@ describe Extractor do it 'does not exclude normal hash text before ://' do text = '#hashtag://' extracted = Extractor.extract_hashtags_with_indices(text) - expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ] + expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }] end it 'excludes http://' do text = '#hashtaghttp://' extracted = Extractor.extract_hashtags_with_indices(text) - expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ] + expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }] end it 'excludes https://' do text = '#hashtaghttps://' extracted = Extractor.extract_hashtags_with_indices(text) - expect(extracted).to eq [ { hashtag: 'hashtag', indices: [ 0, 8 ] } ] + expect(extracted).to eq [{ hashtag: 'hashtag', indices: [0, 8] }] end it 'yields hashtags if a block is given' do diff --git a/spec/lib/fast_ip_map_spec.rb b/spec/lib/fast_ip_map_spec.rb index c66f64828..78b3ddb05 100644 --- a/spec/lib/fast_ip_map_spec.rb +++ b/spec/lib/fast_ip_map_spec.rb @@ -4,7 +4,7 @@ require 'rails_helper' describe FastIpMap do describe '#include?' do - subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')])} + subject { described_class.new([IPAddr.new('20.4.0.0/16'), IPAddr.new('145.22.30.0/24'), IPAddr.new('189.45.86.3')]) } it 'returns true for an exact match' do expect(subject.include?(IPAddr.new('189.45.86.3'))).to be true diff --git a/spec/lib/link_details_extractor_spec.rb b/spec/lib/link_details_extractor_spec.rb index 7ea867c61..7eb15ced3 100644 --- a/spec/lib/link_details_extractor_spec.rb +++ b/spec/lib/link_details_extractor_spec.rb @@ -39,17 +39,17 @@ RSpec.describe LinkDetailsExtractor do let(:original_url) { 'https://example.com/page.html' } context 'and is wrapped in CDATA tags' do - let(:html) { <<-HTML } -<!doctype html> -<html> -<head> - <script type="application/ld+json"> - //<![CDATA[ - {"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"https://example.com/page.html","headline":"Foo","datePublished":"2022-01-31T19:53:00+00:00","url":"https://example.com/page.html","description":"Bar","author":{"@type":"Person","name":"Hoge"},"publisher":{"@type":"Organization","name":"Baz"}} - //]]> - </script> -</head> -</html> + let(:html) { <<~HTML } + <!doctype html> + <html> + <head> + <script type="application/ld+json"> + //<![CDATA[ + {"@context":"http://schema.org","@type":"NewsArticle","mainEntityOfPage":"https://example.com/page.html","headline":"Foo","datePublished":"2022-01-31T19:53:00+00:00","url":"https://example.com/page.html","description":"Bar","author":{"@type":"Person","name":"Hoge"},"publisher":{"@type":"Organization","name":"Baz"}} + //]]> + </script> + </head> + </html> HTML describe '#title' do @@ -78,57 +78,57 @@ RSpec.describe LinkDetailsExtractor do end context 'but the first tag is invalid JSON' do - let(:html) { <<-HTML } -<!doctype html> -<html> -<body> - <script type="application/ld+json"> - { - "@context":"https://schema.org", - "@type":"ItemList", - "url":"https://example.com/page.html", - "name":"Foo", - "description":"Bar" - }, - { - "@context": "https://schema.org", - "@type": "BreadcrumbList", - "itemListElement":[ - { - "@type":"ListItem", - "position":1, - "item":{ - "@id":"https://www.example.com", - "name":"Baz" - } - } - ] - } - </script> - <script type="application/ld+json"> - { - "@context":"https://schema.org", - "@type":"NewsArticle", - "mainEntityOfPage": { - "@type":"WebPage", - "@id": "http://example.com/page.html" - }, - "headline": "Foo", - "description": "Bar", - "datePublished": "2022-01-31T19:46:00+00:00", - "author": { - "@type": "Organization", - "name": "Hoge" - }, - "publisher": { - "@type": "NewsMediaOrganization", - "name":"Baz", - "url":"https://example.com/" - } - } - </script> -</body> -</html> + let(:html) { <<~HTML } + <!doctype html> + <html> + <body> + <script type="application/ld+json"> + { + "@context":"https://schema.org", + "@type":"ItemList", + "url":"https://example.com/page.html", + "name":"Foo", + "description":"Bar" + }, + { + "@context": "https://schema.org", + "@type": "BreadcrumbList", + "itemListElement":[ + { + "@type":"ListItem", + "position":1, + "item":{ + "@id":"https://www.example.com", + "name":"Baz" + } + } + ] + } + </script> + <script type="application/ld+json"> + { + "@context":"https://schema.org", + "@type":"NewsArticle", + "mainEntityOfPage": { + "@type":"WebPage", + "@id": "http://example.com/page.html" + }, + "headline": "Foo", + "description": "Bar", + "datePublished": "2022-01-31T19:46:00+00:00", + "author": { + "@type": "Organization", + "name": "Hoge" + }, + "publisher": { + "@type": "NewsMediaOrganization", + "name":"Baz", + "url":"https://example.com/" + } + } + </script> + </body> + </html> HTML describe '#title' do |