Merge remote-tracking branch 'parent/main' into kbtopic-remove-quote
This commit is contained in:
commit
80542ea172
76 changed files with 658 additions and 390 deletions
|
@ -12,7 +12,7 @@ RSpec.describe CacheBuster do
|
|||
let(:purge_url) { 'https://example.com/test_purge' }
|
||||
|
||||
describe '#bust' do
|
||||
shared_examples 'makes_request' do
|
||||
shared_examples 'cache busting request' do
|
||||
it 'makes an HTTP purging request' do
|
||||
method = http_method&.to_sym || :get
|
||||
stub_request(method, purge_url).to_return(status: 200)
|
||||
|
@ -28,28 +28,28 @@ RSpec.describe CacheBuster do
|
|||
end
|
||||
|
||||
context 'when using default options' do
|
||||
include_examples 'makes_request'
|
||||
it_behaves_like 'cache busting request'
|
||||
end
|
||||
|
||||
context 'when specifying a secret header' do
|
||||
let(:secret_header) { 'X-Purge-Secret' }
|
||||
let(:secret) { SecureRandom.hex(20) }
|
||||
|
||||
include_examples 'makes_request'
|
||||
it_behaves_like 'cache busting request'
|
||||
end
|
||||
|
||||
context 'when specifying a PURGE method' do
|
||||
let(:http_method) { 'purge' }
|
||||
|
||||
context 'when not using headers' do
|
||||
include_examples 'makes_request'
|
||||
it_behaves_like 'cache busting request'
|
||||
end
|
||||
|
||||
context 'when specifying a secret header' do
|
||||
let(:secret_header) { 'X-Purge-Secret' }
|
||||
let(:secret) { SecureRandom.hex(20) }
|
||||
|
||||
include_examples 'makes_request'
|
||||
it_behaves_like 'cache busting request'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -44,14 +44,14 @@ RSpec.describe Fasp::Request do
|
|||
end
|
||||
|
||||
describe '#get' do
|
||||
include_examples 'a provider request', :get
|
||||
it_behaves_like 'a provider request', :get
|
||||
end
|
||||
|
||||
describe '#post' do
|
||||
include_examples 'a provider request', :post
|
||||
it_behaves_like 'a provider request', :post
|
||||
end
|
||||
|
||||
describe '#delete' do
|
||||
include_examples 'a provider request', :delete
|
||||
it_behaves_like 'a provider request', :delete
|
||||
end
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ RSpec.describe LinkDetailsExtractor do
|
|||
</html>
|
||||
HTML
|
||||
|
||||
include_examples 'structured data'
|
||||
it_behaves_like 'structured data'
|
||||
end
|
||||
|
||||
context 'with the first tag is invalid JSON' do
|
||||
|
@ -136,7 +136,7 @@ RSpec.describe LinkDetailsExtractor do
|
|||
</html>
|
||||
HTML
|
||||
|
||||
include_examples 'structured data'
|
||||
it_behaves_like 'structured data'
|
||||
end
|
||||
|
||||
context 'with the first tag is null' do
|
||||
|
@ -154,7 +154,7 @@ RSpec.describe LinkDetailsExtractor do
|
|||
</html>
|
||||
HTML
|
||||
|
||||
include_examples 'structured data'
|
||||
it_behaves_like 'structured data'
|
||||
end
|
||||
|
||||
context 'with preceding block of unsupported LD+JSON' do
|
||||
|
@ -194,7 +194,7 @@ RSpec.describe LinkDetailsExtractor do
|
|||
</html>
|
||||
HTML
|
||||
|
||||
include_examples 'structured data'
|
||||
it_behaves_like 'structured data'
|
||||
end
|
||||
|
||||
context 'with unsupported in same block LD+JSON' do
|
||||
|
@ -218,7 +218,7 @@ RSpec.describe LinkDetailsExtractor do
|
|||
</html>
|
||||
HTML
|
||||
|
||||
include_examples 'structured data'
|
||||
it_behaves_like 'structured data'
|
||||
end
|
||||
|
||||
context 'with author names as array' do
|
||||
|
|
|
@ -56,7 +56,7 @@ RSpec.describe Mastodon::CLI::IpBlocks do
|
|||
end
|
||||
|
||||
context 'with valid IP addresses' do
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
|
||||
context 'when a specified IP address is already blocked' do
|
||||
|
@ -84,7 +84,7 @@ RSpec.describe Mastodon::CLI::IpBlocks do
|
|||
.to('sign_up_requires_approval')
|
||||
end
|
||||
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -101,25 +101,25 @@ RSpec.describe Mastodon::CLI::IpBlocks do
|
|||
context 'with --comment option' do
|
||||
let(:options) { { severity: 'no_access', comment: 'Spam' } }
|
||||
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
|
||||
context 'with --duration option' do
|
||||
let(:options) { { severity: 'no_access', duration: 10.days } }
|
||||
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
|
||||
context 'with "sign_up_requires_approval" severity' do
|
||||
let(:options) { { severity: 'sign_up_requires_approval' } }
|
||||
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
|
||||
context 'with "sign_up_block" severity' do
|
||||
let(:options) { { severity: 'sign_up_block' } }
|
||||
|
||||
include_examples 'ip address blocking'
|
||||
it_behaves_like 'ip address blocking'
|
||||
end
|
||||
|
||||
context 'when a specified IP address fails to be blocked' do
|
||||
|
|
|
@ -207,18 +207,18 @@ RSpec.describe Mastodon::RedisConfiguration do
|
|||
end
|
||||
end
|
||||
|
||||
include_examples 'setting a different driver'
|
||||
include_examples 'setting a namespace'
|
||||
include_examples 'sentinel support'
|
||||
it_behaves_like 'setting a different driver'
|
||||
it_behaves_like 'setting a namespace'
|
||||
it_behaves_like 'sentinel support'
|
||||
end
|
||||
|
||||
describe '#sidekiq' do
|
||||
subject { redis_environment.sidekiq }
|
||||
|
||||
include_examples 'secondary configuration', 'SIDEKIQ'
|
||||
include_examples 'setting a different driver'
|
||||
include_examples 'setting a namespace'
|
||||
include_examples 'sentinel support', 'SIDEKIQ'
|
||||
it_behaves_like 'secondary configuration', 'SIDEKIQ'
|
||||
it_behaves_like 'setting a different driver'
|
||||
it_behaves_like 'setting a namespace'
|
||||
it_behaves_like 'sentinel support', 'SIDEKIQ'
|
||||
end
|
||||
|
||||
describe '#cache' do
|
||||
|
@ -256,8 +256,8 @@ RSpec.describe Mastodon::RedisConfiguration do
|
|||
end
|
||||
end
|
||||
|
||||
include_examples 'secondary configuration', 'CACHE'
|
||||
include_examples 'setting a different driver'
|
||||
include_examples 'sentinel support', 'CACHE'
|
||||
it_behaves_like 'secondary configuration', 'CACHE'
|
||||
it_behaves_like 'setting a different driver'
|
||||
it_behaves_like 'sentinel support', 'CACHE'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue