diff options
author | Thibaut Girka <thib@sitedethib.com> | 2019-08-05 13:13:28 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2019-08-05 13:13:28 +0200 |
commit | e50554391aa726afe18ae1c0bc7ccbf69d7b4aec (patch) | |
tree | b0cbd7b46a733f386c458a6f2f818a899f418b21 /spec | |
parent | ff0ceb28b3f1b19a6851a482f8203e434e50f167 (diff) | |
parent | 6201bfdfba7626c2b6bc5154dda1f41ee8c3ae71 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'spec')
-rw-r--r-- | spec/controllers/well_known/webfinger_controller_spec.rb | 11 | ||||
-rw-r--r-- | spec/lib/feed_manager_spec.rb | 17 | ||||
-rw-r--r-- | spec/models/tag_spec.rb | 4 | ||||
-rw-r--r-- | spec/requests/webfinger_request_spec.rb | 17 |
4 files changed, 19 insertions, 30 deletions
diff --git a/spec/controllers/well_known/webfinger_controller_spec.rb b/spec/controllers/well_known/webfinger_controller_spec.rb index b05745ea3..20275aa63 100644 --- a/spec/controllers/well_known/webfinger_controller_spec.rb +++ b/spec/controllers/well_known/webfinger_controller_spec.rb @@ -56,17 +56,6 @@ PEM expect(json[:aliases]).to include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice') end - it 'returns JSON when account can be found' do - get :show, params: { resource: alice.to_webfinger_s }, format: :xml - - xml = Nokogiri::XML(response.body) - - expect(response).to have_http_status(200) - expect(response.content_type).to eq 'application/xrd+xml' - expect(xml.at_xpath('//xmlns:Subject').content).to eq 'acct:alice@cb6e6126.ngrok.io' - expect(xml.xpath('//xmlns:Alias').map(&:content)).to include('https://cb6e6126.ngrok.io/@alice', 'https://cb6e6126.ngrok.io/users/alice') - end - it 'returns http not found when account cannot be found' do get :show, params: { resource: 'acct:not@existing.com' }, format: :json diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb index d00dd0b55..705e577a6 100644 --- a/spec/lib/feed_manager_spec.rb +++ b/spec/lib/feed_manager_spec.rb @@ -254,6 +254,23 @@ RSpec.describe FeedManager do expect(FeedManager.instance.push_to_home(account, reblogs.last)).to be false end + it 'saves a new reblog of a recently-reblogged status when previous reblog has been deleted' do + account = Fabricate(:account) + reblogged = Fabricate(:status) + old_reblog = Fabricate(:status, reblog: reblogged) + + # The first reblog should be accepted + expect(FeedManager.instance.push_to_home(account, old_reblog)).to be true + + # The first reblog should be successfully removed + expect(FeedManager.instance.unpush_from_home(account, old_reblog)).to be true + + reblog = Fabricate(:status, reblog: reblogged) + + # The second reblog should be accepted + expect(FeedManager.instance.push_to_home(account, reblog)).to be true + end + it 'does not save a new reblog of a multiply-reblogged-then-unreblogged status' do account = Fabricate(:account) reblogged = Fabricate(:status) diff --git a/spec/models/tag_spec.rb b/spec/models/tag_spec.rb index 5f07fd618..9d700849b 100644 --- a/spec/models/tag_spec.rb +++ b/spec/models/tag_spec.rb @@ -136,8 +136,8 @@ RSpec.describe Tag, type: :model do end it 'finds the exact matching tag as the first item' do - similar_tag = Fabricate(:tag, name: "matchlater") - tag = Fabricate(:tag, name: "match") + similar_tag = Fabricate(:tag, name: "matchlater", score: 1) + tag = Fabricate(:tag, name: "match", score: 1) results = Tag.search_for("match") diff --git a/spec/requests/webfinger_request_spec.rb b/spec/requests/webfinger_request_spec.rb index 7f9e1162e..48823714e 100644 --- a/spec/requests/webfinger_request_spec.rb +++ b/spec/requests/webfinger_request_spec.rb @@ -12,23 +12,6 @@ describe 'The webfinger route' do end end - describe 'asking for xml format' do - it 'returns an xml response for xml format' do - get webfinger_url(resource: alice.to_webfinger_s, format: :xml) - - expect(response).to have_http_status(200) - expect(response.content_type).to eq 'application/xrd+xml' - end - - it 'returns an xml response for xml accept header' do - headers = { 'HTTP_ACCEPT' => 'application/xrd+xml' } - get webfinger_url(resource: alice.to_webfinger_s), headers: headers - - expect(response).to have_http_status(200) - expect(response.content_type).to eq 'application/xrd+xml' - end - end - describe 'asking for json format' do it 'returns a json response for json format' do get webfinger_url(resource: alice.to_webfinger_s, format: :json) |