aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-08 22:27:44 +0100
committermms <git@sapka.me>2024-11-08 22:27:44 +0100
commitd82a6d1311ad72dc5a534b982f210f7180cdaeb1 (patch)
treeb5fbde06eeea78e798748af02d031146153d3fb4 /spec
parenteb09313a38aecf7e7cc5292a2fd1c7845609ff1c (diff)
fix: parens in filters
Diffstat (limited to 'spec')
-rw-r--r--spec/messages_spec.rb21
1 files changed, 18 insertions, 3 deletions
diff --git a/spec/messages_spec.rb b/spec/messages_spec.rb
index de8b393..6a84bc3 100644
--- a/spec/messages_spec.rb
+++ b/spec/messages_spec.rb
@@ -38,19 +38,34 @@ RSpec.describe Some::Messages do
describe 'hash filters' do
context 'with singular values' do
- it { expect(subject.filter(from: 'baltar@battlestar.com').query_string).to eq('( (from:baltar@battlestar.com))') }
+ it { expect(subject.filter(from: 'baltar@battlestar.com').query_string).to eq(' (from:baltar@battlestar.com)') }
it {
expect(subject.filter(from: 'baltar@battlestar.com', ship: 'galactica').query_string)
- .to eq('( (from:baltar@battlestar.com) and (ship:galactica))')
+ .to eq(' (from:baltar@battlestar.com) and (ship:galactica)')
+ }
+
+ it {
+ expect(subject.or.filter(from: 'baltar@battlestar.com', ship: 'galactica').query_string)
+ .to eq(' (from:baltar@battlestar.com) or (ship:galactica)')
}
end
context 'with set of values' do
it {
expect(subject.filter(from: ['baltar@battlestar.com',
- 'adama@battestar.com']).query_string).to eq('(( (from:baltar@battlestar.com) or (from:adama@battestar.com)))')
+ 'adama@battestar.com']).query_string)
+ .to eq(' (from:baltar@battlestar.com) or (from:adama@battestar.com)')
}
end
end
+
+ context 'advanced filters' do
+ it {
+ expect(subject.filter(from: ['baltar@battlestar.com', 'adama@battestar.com'])
+ .and.filter(ship: 'battlestar')
+ .or.filter(ship: 'pegasus').query_string)
+ .to eq(' (from:baltar@battlestar.com) or (from:adama@battestar.com) and (ship:battlestar) or (ship:pegasus)')
+ }
+ end
end