このコミットが含まれているのは:
@@ -897,6 +897,37 @@ RSpec.describe 'Gekanator learning API', type: :request do
|
||||
end
|
||||
|
||||
describe 'GET /gekanator/questions' do
|
||||
it 'omits questions for deprecated tags' do
|
||||
active_tag = Tag.create!(name: 'active_question_tag', category: :general)
|
||||
deprecated_tag = Tag.create!(
|
||||
name: 'deprecated_question_tag',
|
||||
category: :general,
|
||||
deprecated_at: Time.current
|
||||
)
|
||||
|
||||
[active_tag, deprecated_tag].each do |question_tag|
|
||||
GekanatorQuestion.create!(
|
||||
text: "#{ question_tag.name }?",
|
||||
kind: 'tag',
|
||||
source: 'admin_curated',
|
||||
status: 'accepted',
|
||||
priority_weight: 1.0,
|
||||
condition: {
|
||||
type: 'tag',
|
||||
key: "#{ question_tag.category }:#{ question_tag.name }"
|
||||
},
|
||||
created_by: admin
|
||||
)
|
||||
end
|
||||
|
||||
get '/gekanator/questions'
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
question_ids = json.fetch('questions').map { |question| question.fetch('id') }
|
||||
expect(question_ids).to include('tag:general:active_question_tag')
|
||||
expect(question_ids).not_to include('tag:general:deprecated_question_tag')
|
||||
end
|
||||
|
||||
it 'returns accepted questions only and includes example_answers for post_similarity questions' do
|
||||
sign_in_as admin
|
||||
|
||||
|
||||
新しい課題から参照
ユーザをブロックする