aboutsummaryrefslogtreecommitdiff
path: root/spec/message_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/message_spec.rb
parent4d87cb470b2c306c126d2d739d50577702374926 (diff)
chore: add specs for all classes
Diffstat (limited to 'spec/message_spec.rb')
-rw-r--r--spec/message_spec.rb46
1 files changed, 0 insertions, 46 deletions
diff --git a/spec/message_spec.rb b/spec/message_spec.rb
deleted file mode 100644
index 5564d34..0000000
--- a/spec/message_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-# frozen_string_literal: true
-
-require 'rspec'
-require_relative '../lib/chotto/message'
-require_relative '../lib/chotto/helpers'
-
-RSpec.describe Chotto::Message do
- let(:tags) { [] }
- let(:msg) { double('Notmuch::Message', tags: tags) }
-
- let(:subject) { Chotto::Message.new(msg: msg) }
-
- it 'reads headers' do
- expect(msg).to receive(:header).with('A-Header')
-
- subject.a_header
- end
-
- describe 'tags' do
- it 'keeps tags state in memory' do
- subject.tags << 'tag'
- expect(subject.tags).to match ['tag']
-
- subject.tags << 'tag2'
- expect(subject.tags).to match %w[tag tag2]
- end
-
- it 'allows to overwritte entire tags array' do
- subject.tags = [1, 2, 3, 4]
- expect(subject.tags).to match [1, 2, 3, 4]
- end
- end
-
- describe 'save!' do
- let(:tags) { [1, 2, 3] }
- it 'saves current tag array to db' do
- expect(msg).to receive(:remove_all_tags)
- tags.each do |tag|
- expect(msg).to receive(:add_tag).with(tag)
- end
-
- subject.tags = tags
- subject.save!
- end
- end
-end