aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
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