このコミットが含まれているのは:
@@ -3,6 +3,7 @@ require 'rails_helper'
|
||||
RSpec.describe 'Post filter identity across locales', type: :request do
|
||||
include_context 'Ainu locale'
|
||||
|
||||
let!(:activated_locale) { locale }
|
||||
let!(:tag) { create(:tag, primary_name: 'legacy_union_source') }
|
||||
let!(:external) { create(:external_tag, name: 'shared') }
|
||||
let!(:internal_post) { create(:post) }
|
||||
|
||||
@@ -53,14 +53,32 @@ RSpec.describe 'Wiki and native API locale contracts', type: :request do
|
||||
expect(response).to have_http_status(:not_found)
|
||||
end
|
||||
|
||||
it 'does not disclose another language through ID, existence, diff or history' do
|
||||
it 'resolves a foreign description ID to only the requested language body' do
|
||||
get "/wiki/#{ japanese.id }", params: { locale: 'ain-Kana' }
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json).to include('id' => ainu.id, 'body' => 'Ainu body')
|
||||
expect(response.body).not_to include('Japanese body')
|
||||
end
|
||||
|
||||
it 'does not reuse foreign revision IDs when resolving a description' do
|
||||
get "/wiki/#{ japanese.id }", params: {
|
||||
locale: 'ain-Kana', version: current_description_version(japanese).id }
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response.body).not_to include('Japanese body')
|
||||
end
|
||||
|
||||
it 'keeps existence and diff scoped to the specified language and description ID' do
|
||||
revision = current_description_version(japanese)
|
||||
["/wiki/#{ japanese.id }", "/wiki/#{ japanese.id }/exists",
|
||||
"/wiki/#{ japanese.id }/diff"].each do |path|
|
||||
["/wiki/#{ japanese.id }/exists", "/wiki/#{ japanese.id }/diff"].each do |path|
|
||||
get path, params: { locale: 'ain-Kana', from: revision.id }
|
||||
expect(response).to have_http_status(:not_found)
|
||||
expect(response.body).not_to include('Japanese body')
|
||||
end
|
||||
get "/wiki/#{ ainu.id }/exists", params: { locale: 'ain-Kana' }
|
||||
expect(response).to have_http_status(:no_content)
|
||||
end
|
||||
|
||||
it 'keeps history scoped to the requested language without foreign revisions' do
|
||||
get '/wiki/changes', params: { locale: 'ain-Kana', id: japanese.id }
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json).to eq([])
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする