diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5bf67597f..b1df4b2d2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,7 +16,6 @@ jobs:
matrix:
ruby:
- 2.7
- - 2.6
db:
- mysql
- postgresql
diff --git a/.rubocop.yml b/.rubocop.yml
index fa0c9d76c..a2791b457 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,7 +1,7 @@
require: rubocop-rails
AllCops:
- TargetRubyVersion: 2.6
+ TargetRubyVersion: 2.7
NewCops: enable
Exclude:
- "bin/**/*"
diff --git a/Changelog.md b/Changelog.md
index 32cb92ae4..958793f68 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -26,9 +26,10 @@ We use yarn to install the frontend dependencies now, so you need to have that i
* Enable Content-Security-Policy header by default [#7781](https://github.com/diaspora/diaspora/pull/7781)
* Do not show getting started after account import [#8036](https://github.com/diaspora/diaspora/pull/8036)
* Remove the JSXC/Prosody integration [#8069](https://github.com/diaspora/diaspora/pull/8069) [#8341](https://github.com/diaspora/diaspora/pull/8341)
-* Replace factory\_girl with factory\_bot [#8218](https://github.com/diaspora/diaspora/pull/8218)
+* Replace `factory_girl` with `factory_bot` [#8218](https://github.com/diaspora/diaspora/pull/8218)
* Drop relay support [#8243](https://github.com/diaspora/diaspora/pull/8243)
* Use yarn to manage the frontend dependencies [#8364](https://github.com/diaspora/diaspora/pull/8364)
+* Upgrade to latest `diaspora_federation`, remove support for old federation protocol [#8368](https://github.com/diaspora/diaspora/pull/8368)
## Bug fixes
* Fix multiple photos upload progress bar [#7655](https://github.com/diaspora/diaspora/pull/7655)
diff --git a/Gemfile b/Gemfile
index 72fca1cd7..56d4904d7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -15,8 +15,8 @@ gem "unicorn-worker-killer", "0.4.5"
# Federation
-gem "diaspora_federation-json_schema", "0.2.8"
-gem "diaspora_federation-rails", "0.2.8"
+gem "diaspora_federation-json_schema", "1.0.0"
+gem "diaspora_federation-rails", "1.0.0"
# API and JSON
@@ -142,11 +142,11 @@ gem "acts-as-taggable-on", "9.0.1"
# URIs and HTTP
-gem "addressable", "2.8.0", require: "addressable/uri"
-gem "faraday", "0.17.5"
-gem "faraday-cookie_jar", "0.0.7"
-gem "faraday_middleware", "0.14.0"
-gem "typhoeus", "1.4.0"
+gem "addressable", "2.8.0", require: "addressable/uri"
+gem "faraday", "1.10.0"
+gem "faraday-cookie_jar", "0.0.7"
+gem "faraday-follow_redirects", "0.3.0"
+gem "typhoeus", "1.4.0"
# Views
@@ -240,12 +240,12 @@ group :test do
# General helpers
- gem "factory_bot_rails", "6.1.0"
+ gem "factory_bot_rails", "6.2.0"
gem "shoulda-matchers", "4.5.1"
gem "timecop", "0.9.5"
gem "webmock", "3.14.0", require: false
- gem "diaspora_federation-test", "0.2.8"
+ gem "diaspora_federation-test", "1.0.0"
end
group :development, :test do
diff --git a/Gemfile.lock b/Gemfile.lock
index 991c1cc58..c02c73753 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -209,19 +209,19 @@ GEM
devise_lastseenable (0.0.6)
devise
rails (>= 3.0.4)
- diaspora_federation (0.2.8)
- faraday (>= 0.9.0, < 1.0)
- faraday_middleware (>= 0.10.0, < 1.0)
+ diaspora_federation (1.0.0)
+ faraday (>= 1.0, < 3)
+ faraday-follow_redirects (~> 0.3)
nokogiri (~> 1.6, >= 1.6.8)
typhoeus (~> 1.0)
valid (~> 1.0)
- diaspora_federation-json_schema (0.2.8)
- diaspora_federation-rails (0.2.8)
- actionpack (>= 4.2, < 7)
- diaspora_federation (= 0.2.8)
- diaspora_federation-test (0.2.8)
- diaspora_federation (= 0.2.8)
- fabrication (~> 2.16)
+ diaspora_federation-json_schema (1.0.0)
+ diaspora_federation-rails (1.0.0)
+ actionpack (>= 5.2, < 8)
+ diaspora_federation (= 1.0.0)
+ diaspora_federation-test (1.0.0)
+ diaspora_federation (= 1.0.0)
+ fabrication (~> 2.29)
uuid (~> 2.3, >= 2.3.8)
diff-lcs (1.5.0)
docile (1.4.0)
@@ -246,19 +246,40 @@ GEM
kostya-sigar (~> 2.0.0)
state_machines
thor
- fabrication (2.22.0)
- factory_bot (6.1.0)
+ fabrication (2.29.0)
+ factory_bot (6.2.1)
activesupport (>= 5.0.0)
- factory_bot_rails (6.1.0)
- factory_bot (~> 6.1.0)
+ factory_bot_rails (6.2.0)
+ factory_bot (~> 6.2.0)
railties (>= 5.0.0)
- faraday (0.17.5)
- multipart-post (>= 1.2, < 3)
+ faraday (1.10.0)
+ faraday-em_http (~> 1.0)
+ faraday-em_synchrony (~> 1.0)
+ faraday-excon (~> 1.1)
+ faraday-httpclient (~> 1.0)
+ faraday-multipart (~> 1.0)
+ faraday-net_http (~> 1.0)
+ faraday-net_http_persistent (~> 1.0)
+ faraday-patron (~> 1.0)
+ faraday-rack (~> 1.0)
+ faraday-retry (~> 1.0)
+ ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7)
faraday (>= 0.8.0)
http-cookie (~> 1.0.0)
- faraday_middleware (0.14.0)
- faraday (>= 0.7.4, < 1.0)
+ faraday-em_http (1.0.0)
+ faraday-em_synchrony (1.0.0)
+ faraday-excon (1.1.0)
+ faraday-follow_redirects (0.3.0)
+ faraday (>= 1, < 3)
+ faraday-httpclient (1.0.1)
+ faraday-multipart (1.0.4)
+ multipart-post (~> 2)
+ faraday-net_http (1.0.1)
+ faraday-net_http_persistent (1.2.0)
+ faraday-patron (1.0.0)
+ faraday-rack (1.0.0)
+ faraday-retry (1.0.3)
ffi (1.15.5)
ffi-compiler (1.0.1)
ffi (>= 1.0.0)
@@ -618,6 +639,7 @@ GEM
ruby-progressbar (1.11.0)
ruby-vips (2.1.4)
ffi (~> 1.12)
+ ruby2_keywords (0.0.5)
rubyzip (2.3.2)
rugged (1.0.1)
sass (3.4.25)
@@ -707,7 +729,7 @@ GEM
unf (~> 0.1.0)
typhoeus (1.4.0)
ethon (>= 0.9.0)
- tzinfo (2.0.4)
+ tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unf (0.1.4)
unf_ext
@@ -778,14 +800,14 @@ DEPENDENCIES
devise (= 4.8.1)
devise-two-factor (= 4.0.2)
devise_lastseenable (= 0.0.6)
- diaspora_federation-json_schema (= 0.2.8)
- diaspora_federation-rails (= 0.2.8)
- diaspora_federation-test (= 0.2.8)
+ diaspora_federation-json_schema (= 1.0.0)
+ diaspora_federation-rails (= 1.0.0)
+ diaspora_federation-test (= 1.0.0)
eye (= 0.10.0)
- factory_bot_rails (= 6.1.0)
- faraday (= 0.17.5)
+ factory_bot_rails (= 6.2.0)
+ faraday (= 1.10.0)
faraday-cookie_jar (= 0.0.7)
- faraday_middleware (= 0.14.0)
+ faraday-follow_redirects (= 0.3.0)
fixture_builder (= 0.5.2)
fog-aws (= 3.14.0)
fuubar (= 2.5.1)
diff --git a/app/helpers/notifications_helper.rb b/app/helpers/notifications_helper.rb
index ffe10a951..6972d811c 100644
--- a/app/helpers/notifications_helper.rb
+++ b/app/helpers/notifications_helper.rb
@@ -20,11 +20,11 @@ module NotificationsHelper
opts.merge!(opts_for_birthday(note))
end
end
- translation(target_type, opts)
+ translation(target_type, **opts)
end
- def translation(target_type, opts = {})
- t("#{target_type}", opts).html_safe
+ def translation(target_type, **kwargs)
+ t(target_type, **kwargs).html_safe # rubocop:disable Rails/OutputSafety
end
def opts_for_post(post)
diff --git a/app/mailers/report_mailer.rb b/app/mailers/report_mailer.rb
index ad69332fd..851635562 100644
--- a/app/mailers/report_mailer.rb
+++ b/app/mailers/report_mailer.rb
@@ -26,7 +26,7 @@ class ReportMailer < ApplicationMailer
private
def format(resource)
- body = I18n.t("notifier.report_email.body", resource)
+ body = I18n.t("notifier.report_email.body", **resource)
mail(to: resource[:email], subject: I18n.t("notifier.report_email.subject", type: resource[:type])) do |format|
format.html { render "notifier/plain_markdown_email", locals: {body: body} }
format.text { render "notifier/plain_markdown_email", locals: {body: body} }
diff --git a/app/presenters/base_presenter.rb b/app/presenters/base_presenter.rb
index 5a55d147f..d4eac8ce1 100644
--- a/app/presenters/base_presenter.rb
+++ b/app/presenters/base_presenter.rb
@@ -20,8 +20,12 @@ class BasePresenter
@current_user = curr_user
end
- def method_missing(method, *args)
- @presentable.public_send(method, *args)
+ def respond_to_missing?(method, include_private=false)
+ @presentable.respond_to?(method) || super
+ end
+
+ def method_missing(method, *args, **kwargs) # rubocop:disable Lint/MissingSuper
+ @presentable.public_send(method, *args, **kwargs)
end
class NilPresenter
diff --git a/app/workers/receive_base.rb b/app/workers/receive_base.rb
index 48c424291..3c84b302a 100644
--- a/app/workers/receive_base.rb
+++ b/app/workers/receive_base.rb
@@ -26,12 +26,7 @@ module Workers
DiasporaFederation::Salmon::InvalidEncoding,
Diaspora::Federation::AuthorIgnored,
Diaspora::Federation::InvalidAuthor,
- Diaspora::Federation::RecipientClosed,
- # TODO: deprecated
- DiasporaFederation::Salmon::MissingMagicEnvelope,
- DiasporaFederation::Salmon::MissingAuthor,
- DiasporaFederation::Salmon::MissingHeader,
- DiasporaFederation::Salmon::InvalidHeader => e
+ Diaspora::Federation::RecipientClosed => e
logger.warn "don't retry for error: #{e.class}"
end
end
diff --git a/app/workers/receive_private.rb b/app/workers/receive_private.rb
index 18534d6f9..580890ea4 100644
--- a/app/workers/receive_private.rb
+++ b/app/workers/receive_private.rb
@@ -6,11 +6,11 @@
module Workers
class ReceivePrivate < ReceiveBase
- def perform(user_id, data, legacy)
+ def perform(user_id, data)
filter_errors_for_retry do
user_private_key = User.where(id: user_id).pluck(:serialized_private_key).first
rsa_key = OpenSSL::PKey::RSA.new(user_private_key)
- DiasporaFederation::Federation::Receiver.receive_private(data, rsa_key, user_id, legacy)
+ DiasporaFederation::Federation::Receiver.receive_private(data, rsa_key, user_id)
end
end
end
diff --git a/app/workers/receive_public.rb b/app/workers/receive_public.rb
index 23c1f72c2..d89850e28 100644
--- a/app/workers/receive_public.rb
+++ b/app/workers/receive_public.rb
@@ -6,9 +6,9 @@
module Workers
class ReceivePublic < ReceiveBase
- def perform(data, legacy=false)
+ def perform(data)
filter_errors_for_retry do
- DiasporaFederation::Federation::Receiver.receive_public(data, legacy)
+ DiasporaFederation::Federation::Receiver.receive_public(data)
end
end
end
diff --git a/config/initializers/diaspora_federation.rb b/config/initializers/diaspora_federation.rb
index 1f56f5c1a..19a9fdfe4 100644
--- a/config/initializers/diaspora_federation.rb
+++ b/config/initializers/diaspora_federation.rb
@@ -44,7 +44,6 @@ DiasporaFederation.configure do |config|
guid: person.guid,
nickname: person.username,
full_name: "#{person.profile.first_name} #{person.profile.last_name}".strip,
- url: AppConfig.pod_uri,
photo_large_url: person.image_url,
photo_medium_url: person.image_url(size: :thumb_medium),
photo_small_url: person.image_url(size: :thumb_small),
@@ -90,15 +89,15 @@ DiasporaFederation.configure do |config|
Diaspora::Federation::Entities.related_entity(entity) if entity
end
- on :queue_public_receive do |xml, legacy=false|
- Workers::ReceivePublic.perform_async(xml, legacy)
+ on :queue_public_receive do |xml|
+ Workers::ReceivePublic.perform_async(xml)
end
- on :queue_private_receive do |guid, xml, legacy=false|
+ on :queue_private_receive do |guid, xml|
person = Person.find_by_guid(guid)
(person.present? && person.owner_id.present?).tap do |user_found|
- Workers::ReceivePrivate.perform_async(person.owner.id, xml, legacy) if user_found
+ Workers::ReceivePrivate.perform_async(person.owner.id, xml) if user_found
end
end
diff --git a/config/initializers/faraday.rb b/config/initializers/faraday.rb
index a54963221..76f9d0a32 100644
--- a/config/initializers/faraday.rb
+++ b/config/initializers/faraday.rb
@@ -20,7 +20,7 @@ options = {
}
Faraday.default_connection = Faraday::Connection.new(options) do |b|
- b.use FaradayMiddleware::FollowRedirects, limit: 8
+ b.use Faraday::FollowRedirects::Middleware, limit: 8
b.use :cookie_jar
b.adapter Faraday.default_adapter
end
diff --git a/features/support/application_cuke_helpers.rb b/features/support/application_cuke_helpers.rb
index 7d1f92cc9..5d7e2b550 100644
--- a/features/support/application_cuke_helpers.rb
+++ b/features/support/application_cuke_helpers.rb
@@ -20,7 +20,7 @@ module ApplicationCukeHelpers
def flash_message(opts={})
selector = opts.delete(:selector)
selector &&= ".alert-#{selector}"
- find(selector || ".flash-message", {match: :first}.merge(opts))
+ find(selector || ".flash-message", **{match: :first}.merge(opts))
end
def confirm_form_validation_error(element)
diff --git a/features/support/paths.rb b/features/support/paths.rb
index d6c7ff157..01cada463 100644
--- a/features/support/paths.rb
+++ b/features/support/paths.rb
@@ -63,7 +63,7 @@ module NavigationHelpers
if path.is_a?(Hash)
visit(path[:path])
await_elem = path[:special_elem]
- find(await_elem.delete(:selector), await_elem)
+ find(await_elem.delete(:selector), **await_elem)
else
visit(path)
end
diff --git a/lib/connection_tester.rb b/lib/connection_tester.rb
index 5bc58d75b..ef5a4abf8 100644
--- a/lib/connection_tester.rb
+++ b/lib/connection_tester.rb
@@ -114,7 +114,7 @@ class ConnectionTester
raise NetFailure, e.message
rescue Faraday::SSLError => e
raise SSLFailure, e.message
- rescue ArgumentError, FaradayMiddleware::RedirectLimitReached, Faraday::ClientError => e
+ rescue ArgumentError, Faraday::FollowRedirects::RedirectLimitReached, Faraday::ClientError => e
raise HTTPFailure, e.message
rescue StandardError => e
unexpected_error(e)
@@ -146,7 +146,7 @@ class ConnectionTester
def with_http_connection
@http ||= Faraday.new(@url) do |c|
c.use Faraday::Response::RaiseError
- c.use FaradayMiddleware::FollowRedirects, limit: 3
+ c.use Faraday::FollowRedirects::Middleware, limit: 3
c.adapter(Faraday.default_adapter)
c.headers[:user_agent] = "diaspora-connection-tester"
c.options.timeout = 12
diff --git a/lib/pubsubhubbub.rb b/lib/pubsubhubbub.rb
index 66f899ba6..a6a566173 100644
--- a/lib/pubsubhubbub.rb
+++ b/lib/pubsubhubbub.rb
@@ -14,8 +14,8 @@ class Pubsubhubbub
conn = Faraday.new do |c|
c.use Faraday::Request::UrlEncoded # encode request params as "www-form-urlencoded"
- c.use Faraday::Adapter::NetHttp # perform requests with Net::HTTP
+ c.adapter Faraday::Adapter::NetHttp # perform requests with Net::HTTP
end
conn.post @hub, {'hub.url' => feed, 'hub.mode' => 'publish'}
end
-end
\ No newline at end of file
+end
diff --git a/spec/federation_callbacks_spec.rb b/spec/federation_callbacks_spec.rb
index bd33d3bd6..6200af866 100644
--- a/spec/federation_callbacks_spec.rb
+++ b/spec/federation_callbacks_spec.rb
@@ -50,7 +50,6 @@ describe "diaspora federation callbacks" do
expect(hcard.guid).to eq(person.guid)
expect(hcard.nickname).to eq(person.username)
expect(hcard.full_name).to eq("#{person.profile.first_name} #{person.profile.last_name}")
- expect(hcard.url).to eq(AppConfig.pod_uri)
expect(hcard.photo_large_url).to eq(person.image_url)
expect(hcard.photo_medium_url).to eq(person.image_url(size: :thumb_medium))
expect(hcard.photo_small_url).to eq(person.image_url(size: :thumb_small))
@@ -310,9 +309,9 @@ describe "diaspora federation callbacks" do
describe ":queue_public_receive" do
it "enqueues a ReceivePublic job" do
data = ""
- expect(Workers::ReceivePublic).to receive(:perform_async).with(data, true)
+ expect(Workers::ReceivePublic).to receive(:perform_async).with(data)
- DiasporaFederation.callbacks.trigger(:queue_public_receive, data, true)
+ DiasporaFederation.callbacks.trigger(:queue_public_receive, data)
end
end
@@ -325,19 +324,19 @@ describe "diaspora federation callbacks" do
end
it "enqueues a ReceivePrivate job" do
- expect(Workers::ReceivePrivate).to receive(:perform_async).with(alice.id, data, true)
+ expect(Workers::ReceivePrivate).to receive(:perform_async).with(alice.id, data)
- DiasporaFederation.callbacks.trigger(:queue_private_receive, alice.person.guid, data, true)
+ DiasporaFederation.callbacks.trigger(:queue_private_receive, alice.person.guid, data)
end
it "returns false if the no user is found" do
person = FactoryBot.create(:person)
- result = DiasporaFederation.callbacks.trigger(:queue_private_receive, person.guid, data, true)
+ result = DiasporaFederation.callbacks.trigger(:queue_private_receive, person.guid, data)
expect(result).to be_falsey
end
it "returns false if the no person is found" do
- result = DiasporaFederation.callbacks.trigger(:queue_private_receive, "2398rq3948yftn", data, true)
+ result = DiasporaFederation.callbacks.trigger(:queue_private_receive, "2398rq3948yftn", data)
expect(result).to be_falsey
end
end
diff --git a/spec/integration/federation/federation_helper.rb b/spec/integration/federation/federation_helper.rb
index 2e471f711..76395c509 100644
--- a/spec/integration/federation/federation_helper.rb
+++ b/spec/integration/federation/federation_helper.rb
@@ -55,10 +55,6 @@ def allow_callbacks(callbacks)
end
def create_relayable_entity(entity_name, parent, diaspora_id)
- expect(DiasporaFederation.callbacks).to receive(:trigger).with(
- :fetch_private_key, alice.diaspora_handle
- ).at_least(1).times.and_return(nil) if parent == local_parent
-
Fabricate(
entity_name,
parent_guid: parent.guid,
diff --git a/spec/lib/diaspora/federated/retraction_spec.rb b/spec/lib/diaspora/federated/retraction_spec.rb
index 8da330007..cf459d245 100644
--- a/spec/lib/diaspora/federated/retraction_spec.rb
+++ b/spec/lib/diaspora/federated/retraction_spec.rb
@@ -71,7 +71,7 @@ describe Retraction do
expect(Workers::DeferredRetraction).to receive(:perform_async).with(
local_luke.id, "Retraction", federation_retraction.to_h.deep_stringify_keys, [remote_raphael.id],
- "service_types" => []
+ {"service_types" => []}
)
retraction.defer_dispatch(local_luke)
@@ -87,7 +87,7 @@ describe Retraction do
expect(Workers::DeferredRetraction).to receive(:perform_async).with(
alice.id, "Retraction", federation_retraction.to_h.deep_stringify_keys, [],
- "service_types" => ["Services::Twitter"], "tweet_id" => "123"
+ {"service_types" => ["Services::Twitter"], "tweet_id" => "123"}
)
retraction.defer_dispatch(alice)
@@ -98,7 +98,7 @@ describe Retraction do
federation_retraction = Diaspora::Federation::Entities.retraction(retraction)
expect(Workers::DeferredRetraction).to receive(:perform_async).with(
- alice.id, "Retraction", federation_retraction.to_h.deep_stringify_keys, [], "service_types" => []
+ alice.id, "Retraction", federation_retraction.to_h.deep_stringify_keys, [], {"service_types" => []}
)
retraction.defer_dispatch(alice)
diff --git a/spec/models/user/connecting_spec.rb b/spec/models/user/connecting_spec.rb
index e93b6936f..0dab12553 100644
--- a/spec/models/user/connecting_spec.rb
+++ b/spec/models/user/connecting_spec.rb
@@ -181,7 +181,7 @@ describe User::Connecting, type: :model do
it "delivers profile for remote persons" do
allow(Diaspora::Federation::Dispatcher).to receive(:defer_dispatch)
expect(Diaspora::Federation::Dispatcher)
- .to receive(:defer_dispatch).with(alice, alice.profile, subscriber_ids: [remote_raphael.id])
+ .to receive(:defer_dispatch).with(alice, alice.profile, {subscriber_ids: [remote_raphael.id]})
alice.share_with(remote_raphael, alice.aspects.first)
end
diff --git a/spec/workers/mail/invite_email_spec.rb b/spec/workers/mail/invite_email_spec.rb
index 44e0cef79..2db2d9e4e 100644
--- a/spec/workers/mail/invite_email_spec.rb
+++ b/spec/workers/mail/invite_email_spec.rb
@@ -6,8 +6,7 @@ describe Workers::Mail::InviteEmail do
let(:email_inviter) { double('EmailInviter') }
it 'creates a new email inviter' do
- expect(EmailInviter).to receive(:new).with(emails, alice, message: message)
- .and_return(email_inviter)
+ expect(EmailInviter).to receive(:new).with(emails, alice, {message: message}).and_return(email_inviter)
expect(email_inviter).to receive(:send!)
Workers::Mail::InviteEmail.new.perform(emails, alice.id, message: message)
end
diff --git a/spec/workers/receive_private_spec.rb b/spec/workers/receive_private_spec.rb
index 288db75e3..0f3de7a9e 100644
--- a/spec/workers/receive_private_spec.rb
+++ b/spec/workers/receive_private_spec.rb
@@ -7,9 +7,9 @@ describe Workers::ReceivePrivate do
rsa_key = double
expect(OpenSSL::PKey::RSA).to receive(:new).with(alice.serialized_private_key).and_return(rsa_key)
- expect(DiasporaFederation::Federation::Receiver).to receive(:receive_private).with(data, rsa_key, alice.id, true)
+ expect(DiasporaFederation::Federation::Receiver).to receive(:receive_private).with(data, rsa_key, alice.id)
- Workers::ReceivePrivate.new.perform(alice.id, data, true)
+ Workers::ReceivePrivate.new.perform(alice.id, data)
end
it "filters errors that would also fail on second try" do
@@ -17,11 +17,11 @@ describe Workers::ReceivePrivate do
expect(OpenSSL::PKey::RSA).to receive(:new).with(alice.serialized_private_key).and_return(rsa_key)
expect(DiasporaFederation::Federation::Receiver).to receive(:receive_private).with(
- data, rsa_key, alice.id, false
+ data, rsa_key, alice.id
).and_raise(DiasporaFederation::Salmon::InvalidSignature)
expect {
- Workers::ReceivePrivate.new.perform(alice.id, data, false)
+ Workers::ReceivePrivate.new.perform(alice.id, data)
}.not_to raise_error
end
@@ -30,11 +30,11 @@ describe Workers::ReceivePrivate do
expect(OpenSSL::PKey::RSA).to receive(:new).with(alice.serialized_private_key).and_return(rsa_key)
expect(DiasporaFederation::Federation::Receiver).to receive(:receive_private).with(
- data, rsa_key, alice.id, false
+ data, rsa_key, alice.id
).and_raise(DiasporaFederation::Federation::Fetcher::NotFetchable)
expect {
- Workers::ReceivePrivate.new.perform(alice.id, data, false)
+ Workers::ReceivePrivate.new.perform(alice.id, data)
}.to raise_error DiasporaFederation::Federation::Fetcher::NotFetchable
end
end
diff --git a/spec/workers/receive_public_spec.rb b/spec/workers/receive_public_spec.rb
index 2b97dbd20..ed543fa9f 100644
--- a/spec/workers/receive_public_spec.rb
+++ b/spec/workers/receive_public_spec.rb
@@ -4,28 +4,26 @@ describe Workers::ReceivePublic do
let(:data) { "" }
it "calls receive_public of federation gem" do
- expect(DiasporaFederation::Federation::Receiver).to receive(:receive_public).with(data, true)
+ expect(DiasporaFederation::Federation::Receiver).to receive(:receive_public).with(data)
- Workers::ReceivePublic.new.perform(data, true)
+ Workers::ReceivePublic.new.perform(data)
end
it "filters errors that would also fail on second try" do
- expect(DiasporaFederation::Federation::Receiver).to receive(:receive_public).with(
- data, false
- ).and_raise(DiasporaFederation::Salmon::InvalidSignature)
+ expect(DiasporaFederation::Federation::Receiver)
+ .to receive(:receive_public).with(data).and_raise(DiasporaFederation::Salmon::InvalidSignature)
expect {
- Workers::ReceivePublic.new.perform(data, false)
+ Workers::ReceivePublic.new.perform(data)
}.not_to raise_error
end
it "does not filter errors that would succeed on second try" do
- expect(DiasporaFederation::Federation::Receiver).to receive(:receive_public).with(
- data, false
- ).and_raise(DiasporaFederation::Federation::Fetcher::NotFetchable)
+ expect(DiasporaFederation::Federation::Receiver)
+ .to receive(:receive_public).with(data).and_raise(DiasporaFederation::Federation::Fetcher::NotFetchable)
expect {
- Workers::ReceivePublic.new.perform(data, false)
+ Workers::ReceivePublic.new.perform(data)
}.to raise_error DiasporaFederation::Federation::Fetcher::NotFetchable
end
end