|
28 | 28 | context 'comparing millisecond precision' do
|
29 | 29 | let(:time_millis) {Time.utc(2021, 10, 25, 10, 30, 30, 581774)}
|
30 | 30 |
|
31 |
| - context 'with exact match' do |
32 |
| - let(:query) do |
33 |
| - {'started_at' => time_millis} |
34 |
| - end |
35 |
| - |
36 |
| - it_behaves_like 'is true' |
| 31 | + context "when compare_time_by_ms feature flag is set" do |
| 32 | + config_override :compare_time_by_ms, true |
37 | 33 |
|
38 |
| - context 'and query has different timezone' do |
39 |
| - let(:time_millis) do |
40 |
| - Time.utc(2021, 10, 25, 10, 30, 30, 581345).in_time_zone("Stockholm") |
| 34 | + context 'with exact match' do |
| 35 | + let(:query) do |
| 36 | + {'started_at' => time_millis} |
41 | 37 | end
|
42 | 38 |
|
43 | 39 | it_behaves_like 'is true'
|
44 |
| - end |
45 |
| - end |
46 | 40 |
|
47 |
| - context "when compare_time_by_ms feature flag is set" do |
48 |
| - config_override :compare_time_by_ms, true |
| 41 | + context 'and query has different timezone' do |
| 42 | + let(:time_millis) do |
| 43 | + Time.utc(2021, 10, 25, 10, 30, 30, 581345).in_time_zone("Stockholm") |
| 44 | + end |
| 45 | + |
| 46 | + it_behaves_like 'is true' |
| 47 | + end |
| 48 | + end |
49 | 49 |
|
50 | 50 | context 'with $in' do
|
51 | 51 | let(:query) do
|
|
54 | 54 |
|
55 | 55 | it_behaves_like 'is true'
|
56 | 56 | end
|
| 57 | + |
| 58 | + context 'when matching an element in an array' do |
| 59 | + let(:document) do |
| 60 | + Mop.new(:array_field => [time]) |
| 61 | + end |
| 62 | + |
| 63 | + context 'with equals match' do |
| 64 | + let(:query) do |
| 65 | + {'array_field' => time_millis} |
| 66 | + end |
| 67 | + |
| 68 | + it_behaves_like 'is true' |
| 69 | + end |
| 70 | + end |
57 | 71 | end
|
58 | 72 |
|
59 | 73 | context "when compare_time_by_ms feature flag is not set" do
|
60 | 74 | config_override :compare_time_by_ms, false
|
61 | 75 |
|
62 |
| - context 'with $in' do |
| 76 | + context 'with exact match' do |
63 | 77 | let(:query) do
|
64 |
| - {'started_at' => {:$in => [time_millis]}} |
| 78 | + {'started_at' => time_millis} |
65 | 79 | end
|
66 | 80 |
|
67 | 81 | it_behaves_like 'is false'
|
68 |
| - end |
69 |
| - end |
70 | 82 |
|
71 |
| - context 'when matching an element in an array' do |
72 |
| - let(:document) do |
73 |
| - Mop.new(:array_field => [time]) |
| 83 | + context 'and query has different timezone' do |
| 84 | + let(:time_millis) do |
| 85 | + Time.utc(2021, 10, 25, 10, 30, 30, 581345).in_time_zone("Stockholm") |
| 86 | + end |
| 87 | + |
| 88 | + it_behaves_like 'is true' |
| 89 | + end |
74 | 90 | end
|
75 | 91 |
|
76 |
| - context 'with equals match' do |
| 92 | + context 'with $in' do |
77 | 93 | let(:query) do
|
78 |
| - {'array_field' => time_millis} |
| 94 | + {'started_at' => {:$in => [time_millis]}} |
79 | 95 | end
|
80 | 96 |
|
81 |
| - it_behaves_like 'is true' |
| 97 | + it_behaves_like 'is false' |
| 98 | + end |
| 99 | + |
| 100 | + context 'when matching an element in an array' do |
| 101 | + let(:document) do |
| 102 | + Mop.new(:array_field => [time]) |
| 103 | + end |
| 104 | + |
| 105 | + context 'with equals match' do |
| 106 | + let(:query) do |
| 107 | + {'array_field' => time_millis} |
| 108 | + end |
| 109 | + |
| 110 | + it_behaves_like 'is false' |
| 111 | + end |
82 | 112 | end
|
83 | 113 | end
|
84 | 114 | end
|
|
0 commit comments