about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/controllers/api/salmon_controller_spec.rb9
-rw-r--r--spec/controllers/api/subscriptions_controller_spec.rb3
-rw-r--r--spec/controllers/concerns/signature_verification_spec.rb2
3 files changed, 5 insertions, 9 deletions
diff --git a/spec/controllers/api/salmon_controller_spec.rb b/spec/controllers/api/salmon_controller_spec.rb
index 5f01f8073..8ce4913a5 100644
--- a/spec/controllers/api/salmon_controller_spec.rb
+++ b/spec/controllers/api/salmon_controller_spec.rb
@@ -15,8 +15,7 @@ RSpec.describe Api::SalmonController, type: :controller do
   describe 'POST #update' do
     context 'with valid post data' do
       before do
-        request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
-        post :update, params: { id: account.id }
+        post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
       end
 
       it 'contains XML in the request body' do
@@ -42,8 +41,7 @@ RSpec.describe Api::SalmonController, type: :controller do
 
     context 'with empty post data' do
       before do
-        request.env['RAW_POST_DATA'] = ''
-        post :update, params: { id: account.id }
+        post :update, params: { id: account.id }, body: ''
       end
 
       it 'returns http client error' do
@@ -56,8 +54,7 @@ RSpec.describe Api::SalmonController, type: :controller do
         service = double(call: false)
         allow(VerifySalmonService).to receive(:new).and_return(service)
 
-        request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
-        post :update, params: { id: account.id }
+        post :update, params: { id: account.id }, body: File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
       end
 
       it 'returns http client error' do
diff --git a/spec/controllers/api/subscriptions_controller_spec.rb b/spec/controllers/api/subscriptions_controller_spec.rb
index 48eb1fc64..b46971a54 100644
--- a/spec/controllers/api/subscriptions_controller_spec.rb
+++ b/spec/controllers/api/subscriptions_controller_spec.rb
@@ -53,9 +53,8 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
       stub_request(:any, "https://mastodon.social/users/Gargron").to_return(status: 404)
 
       request.env['HTTP_X_HUB_SIGNATURE'] = "sha1=#{OpenSSL::HMAC.hexdigest('sha1', 'abc', feed)}"
-      request.env['RAW_POST_DATA'] = feed
 
-      post :update, params: { id: account.id }
+      post :update, params: { id: account.id }, body: feed
     end
 
     it 'returns http success' do
diff --git a/spec/controllers/concerns/signature_verification_spec.rb b/spec/controllers/concerns/signature_verification_spec.rb
index 64648621e..3daf1fc4e 100644
--- a/spec/controllers/concerns/signature_verification_spec.rb
+++ b/spec/controllers/concerns/signature_verification_spec.rb
@@ -105,7 +105,7 @@ describe ApplicationController, type: :controller do
         end
 
         it 'returns nil when body has been tampered' do
-          request.headers['RAW_POST_DATA'] = 'doo doo doo'
+          post :success, body: 'doo doo doo'
           expect(controller.signed_request_account).to be_nil
         end
       end