aboutsummaryrefslogtreecommitdiff
path: root/spec/messages_spec.rb
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-14 22:34:47 +0100
committermms <git@sapka.me>2024-11-14 22:34:57 +0100
commit8c084e0faa971e6db265ea39aefb8cf07e39de43 (patch)
tree899e4f6f8e7e33ab01d09ad917c86fd32944a4bb /spec/messages_spec.rb
parent4d87cb470b2c306c126d2d739d50577702374926 (diff)
chore: add specs for all classes
Diffstat (limited to 'spec/messages_spec.rb')
-rw-r--r--spec/messages_spec.rb71
1 files changed, 0 insertions, 71 deletions
diff --git a/spec/messages_spec.rb b/spec/messages_spec.rb
deleted file mode 100644
index ec43379..0000000
--- a/spec/messages_spec.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-# frozen_string_literal: true
-
-require 'rspec'
-require_relative '../lib/chotto/messages'
-
-RSpec.describe Chotto::Messages do
- let(:subject) { Chotto::Messages.new(db: double('Notmuch')) }
-
- 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
-
- 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', ship: 'galactica').query_string)
- .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)')
- }
- 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