このコミットが含まれているのは:
2026-11-01 04:22:26 +09:00
コミット 29002d5393
20個のファイルの変更、419行の追加、102行の削除
+28
ファイルの表示
@@ -91,6 +91,34 @@ RSpec.describe 'Counts table API', type: :request do
expect(versions(query(predicate.merge('conditions.0.value' => 'true')))).to eq([3])
end
it 'distinguishes the snapshot cutoff from the current latest flag and condition' do
past = { definition: 'latest', at: '2024-01-31T16:00:00Z' }
result = query(past)
expect(versions(result)).to eq([2])
expect(result['versions'].first['latest']).to be(false)
predicate = { conditions: '', 'conditions.0.field' => 'latest',
'conditions.0.operator' => 'eq', 'conditions.0.value' => 'false' }
expect(versions(query(past.merge(predicate)))).to eq([2])
expect(versions(query(past.merge(predicate).merge('conditions.0.value' => 'true'))))
.to eq([])
unchanged = query(definition: 'latest', at: '2024-02-01T00:00:00Z')
expect(versions(unchanged)).to eq([3])
expect(unchanged['versions'].first['latest']).to be(true)
expect(versions(query(sort: 'latest:desc resource_id:asc version_no:asc'))).to eq([3, 1, 2])
end
it 'checks the current latest flag beyond the execution timestamp' do
PostVersion.create!(post: record, version_no: 4, event_type: 'update',
url: record.url, title: 'after execution', tags: '', tags_json: [],
parent_post_ids: '', created_at: Time.utc(2025, 2, 1))
result = query
expect(versions(result)).to eq([1, 2, 3])
expect(result['versions'].map { _1['latest'] }).to eq([false, false, false])
snapshot = query(definition: 'latest')
expect(versions(snapshot)).to eq([3])
expect(snapshot['versions'].first['latest']).to be(false)
end
it 'keeps ANY, ALL and NONE distinct without multiplying parent records' do
values = { conditions: '', 'conditions.0.field' => 'tags',
'conditions.0.values' => '1', condition_values: '',