about summary refs log tree commit diff
path: root/spec/models/concerns
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models/concerns')
-rw-r--r--spec/models/concerns/account_interactions_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
new file mode 100644
index 000000000..a468549d8
--- /dev/null
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -0,0 +1,38 @@
+require 'rails_helper'
+
+describe AccountInteractions do
+  describe 'muting an account' do
+    let(:me) { Fabricate(:account, username: 'Me') }
+    let(:you) { Fabricate(:account, username: 'You') }
+
+    context 'with the notifications option unspecified' do
+      before do
+        me.mute!(you)
+      end
+
+      it 'defaults to muting notifications' do
+        expect(me.muting_notifications?(you)).to be true
+      end
+    end
+
+    context 'with the notifications option set to false' do
+      before do
+        me.mute!(you, notifications: false)
+      end
+
+      it 'does not mute notifications' do
+        expect(me.muting_notifications?(you)).to be false
+      end
+    end
+
+    context 'with the notifications option set to true' do
+      before do
+        me.mute!(you, notifications: true)
+      end
+
+      it 'does mute notifications' do
+        expect(me.muting_notifications?(you)).to be true
+      end
+    end
+  end
+end