forked from fedi/mastodon
parent
110b3f6335
commit
2aeeffc3ec
2
Gemfile
2
Gemfile
|
@ -6,7 +6,7 @@ ruby '>= 2.3.0', '< 2.6.0'
|
|||
gem 'pkg-config', '~> 1.3'
|
||||
|
||||
gem 'puma', '~> 3.11'
|
||||
gem 'rails', '~> 5.2.0'
|
||||
gem 'rails', '~> 5.2.1'
|
||||
|
||||
gem 'hamlit-rails', '~> 0.2'
|
||||
gem 'pg', '~> 1.0'
|
||||
|
|
88
Gemfile.lock
88
Gemfile.lock
|
@ -15,25 +15,25 @@ GIT
|
|||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
actioncable (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actioncable (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
actionmailer (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
actionpack (5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionview (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
actionview (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
|
@ -44,20 +44,20 @@ GEM
|
|||
case_transform (>= 0.2)
|
||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
|
||||
active_record_query_trace (1.5.4)
|
||||
activejob (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activejob (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activerecord (5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activemodel (5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
activerecord (5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
activestorage (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.0)
|
||||
activesupport (5.2.1)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -269,7 +269,7 @@ GEM
|
|||
httplog (1.0.2)
|
||||
colorize (~> 0.8)
|
||||
rack (>= 1.0)
|
||||
i18n (1.0.1)
|
||||
i18n (1.1.0)
|
||||
concurrent-ruby (~> 1.0)
|
||||
i18n-tasks (0.9.21)
|
||||
activesupport (>= 4.0.2)
|
||||
|
@ -346,8 +346,8 @@ GEM
|
|||
net-scp (1.2.1)
|
||||
net-ssh (>= 2.6.5)
|
||||
net-ssh (4.2.0)
|
||||
nio4r (2.3.0)
|
||||
nokogiri (1.8.2)
|
||||
nio4r (2.3.1)
|
||||
nokogiri (1.8.4)
|
||||
mini_portile2 (~> 2.3.0)
|
||||
nokogumbo (1.5.0)
|
||||
nokogiri
|
||||
|
@ -415,7 +415,7 @@ GEM
|
|||
puma (3.11.4)
|
||||
pundit (1.1.0)
|
||||
activesupport (>= 3.0.0)
|
||||
rack (2.0.4)
|
||||
rack (2.0.5)
|
||||
rack-attack (5.2.0)
|
||||
rack
|
||||
rack-cors (1.0.2)
|
||||
|
@ -423,20 +423,20 @@ GEM
|
|||
rack
|
||||
rack-proxy (0.6.4)
|
||||
rack
|
||||
rack-test (1.0.0)
|
||||
rack-test (1.1.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rails (5.2.0)
|
||||
actioncable (= 5.2.0)
|
||||
actionmailer (= 5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
activestorage (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
rails (5.2.1)
|
||||
actioncable (= 5.2.1)
|
||||
actionmailer (= 5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
actionview (= 5.2.1)
|
||||
activejob (= 5.2.1)
|
||||
activemodel (= 5.2.1)
|
||||
activerecord (= 5.2.1)
|
||||
activestorage (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.2.0)
|
||||
railties (= 5.2.1)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.2)
|
||||
actionpack (~> 5.x, >= 5.0.1)
|
||||
|
@ -452,12 +452,12 @@ GEM
|
|||
railties (>= 5.0, < 6)
|
||||
rails-settings-cached (0.6.6)
|
||||
rails (>= 4.2.0)
|
||||
railties (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
railties (5.2.1)
|
||||
actionpack (= 5.2.1)
|
||||
activesupport (= 5.2.1)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
thor (>= 0.19.0, < 2.0)
|
||||
rainbow (3.0.0)
|
||||
rake (12.3.1)
|
||||
rb-fsevent (0.10.3)
|
||||
|
@ -725,7 +725,7 @@ DEPENDENCIES
|
|||
pundit (~> 1.1)
|
||||
rack-attack (~> 5.2)
|
||||
rack-cors (~> 1.0)
|
||||
rails (~> 5.2.0)
|
||||
rails (~> 5.2.1)
|
||||
rails-controller-testing (~> 1.0)
|
||||
rails-i18n (~> 5.1)
|
||||
rails-settings-cached (~> 0.6)
|
||||
|
@ -764,4 +764,4 @@ RUBY VERSION
|
|||
ruby 2.5.0p0
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.2
|
||||
1.16.3
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue