diff options
author | mms <git@sapka.me> | 2024-11-07 22:31:31 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-11-07 22:31:31 +0100 |
commit | eb327b3b8ccde4f0a682a0167af8fc4ab89d3958 (patch) | |
tree | f044a1093ad9528bb27f6aa2297db6e3cd0fa603 /spec/messages_spec.rb | |
parent | a8d3a3d70e6e69ae5c98b7066c62d9dc9625907c (diff) |
feat: basic filters
Diffstat (limited to 'spec/messages_spec.rb')
-rw-r--r-- | spec/messages_spec.rb | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/messages_spec.rb b/spec/messages_spec.rb new file mode 100644 index 0000000..5998fd1 --- /dev/null +++ b/spec/messages_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'rspec' +require_relative '../lib/some/messages' + +RSpec.describe Some::Messages do + let(:subject) { Some::Messages.new } + + describe 'direct filters' 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').filter('ship:galactica').query_string) + .to eq(' (from:baltar@battlestar.com) and (ship:galactica)') + } + end + + describe 'conjuction change' do + it { + expect(subject.filter('from:baltar@battlestar.com') + .or.filter('ship:galactica').query_string).to eq(' (from:baltar@battlestar.com) or (ship:galactica)') + } + + it { + expect(subject.filter('from:baltar@battlestar.com') + .or.filter('ship:galactica') + .filter('hair:long').query_string) + .to eq(' (from:baltar@battlestar.com) or (ship:galactica) or (hair:long)') + } + + it { + expect(subject.filter('from:baltar@battlestar.com') + .or.filter('ship:galactica') + .and.filter('hair:long').query_string) + .to eq(' (from:baltar@battlestar.com) or (ship:galactica) and (hair:long)') + } + end +end |