このコミットが含まれているのは:
@@ -475,28 +475,59 @@ RSpec.describe 'Gekanator learning API', type: :request do
|
||||
end
|
||||
|
||||
describe 'GET /gekanator/games/:id/extra_questions' do
|
||||
it 'returns at most two accepted user_suggested post_similarity questions without duplicates' do
|
||||
it 'returns at most six accepted user_suggested post_similarity questions without duplicates' do
|
||||
sign_in_as admin
|
||||
|
||||
lowest = create_post_similarity_question!(
|
||||
text: 'lowest?',
|
||||
priority_weight: 0.5
|
||||
)
|
||||
low = create_post_similarity_question!(
|
||||
text: 'low?',
|
||||
priority_weight: 1.0
|
||||
)
|
||||
high = create_post_similarity_question!(
|
||||
text: 'high?',
|
||||
priority_weight: 3.0
|
||||
)
|
||||
middle = create_post_similarity_question!(
|
||||
text: 'middle?',
|
||||
priority_weight: 1.5
|
||||
)
|
||||
medium_high = create_post_similarity_question!(
|
||||
text: 'medium high?',
|
||||
priority_weight: 2.0
|
||||
)
|
||||
high = create_post_similarity_question!(
|
||||
text: 'high?',
|
||||
priority_weight: 2.5
|
||||
)
|
||||
higher = create_post_similarity_question!(
|
||||
text: 'higher?',
|
||||
priority_weight: 2.8
|
||||
)
|
||||
highest = create_post_similarity_question!(
|
||||
text: 'highest?',
|
||||
priority_weight: 3.0
|
||||
)
|
||||
overflow = create_post_similarity_question!(
|
||||
text: 'overflow?',
|
||||
priority_weight: 2.2
|
||||
)
|
||||
|
||||
get "/gekanator/games/#{game.id}/extra_questions"
|
||||
|
||||
expect(response).to have_http_status(:ok)
|
||||
expect(json['questions'].length).to eq(2)
|
||||
expect(json['questions'].map { _1['id'] }.uniq.length).to eq(2)
|
||||
expect(json['questions'].map { _1['id'] }).to all(be_in([low.id, high.id, middle.id]))
|
||||
expect(json['questions'].length).to eq(6)
|
||||
expect(json['questions'].map { _1['id'] }.uniq.length).to eq(6)
|
||||
expect(json['questions'].map { _1['id'] }).to all(
|
||||
be_in([
|
||||
lowest.id,
|
||||
low.id,
|
||||
middle.id,
|
||||
medium_high.id,
|
||||
high.id,
|
||||
higher.id,
|
||||
highest.id,
|
||||
overflow.id,
|
||||
])
|
||||
)
|
||||
end
|
||||
|
||||
it 'can return questions that already have an example for the correct post' do
|
||||
|
||||
新しい課題から参照
ユーザをブロックする