about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
authorSurinna Curtis <ekiru.0@gmail.com>2017-07-27 09:00:29 -0500
committerSurinna Curtis <ekiru.0@gmail.com>2017-09-13 21:47:30 -0500
commit0f2af2a974df33c4e0ae89f6345eb16b288e9f41 (patch)
tree7940339169d0f53216b81ecce6ce2afdd0385c77 /spec/models
parent27f8d7069beeb1996fe8121dddfbcf3fe60248a6 (diff)
Add specs for how mute! interacts with muting_notifications?
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/concerns/account_interactions_spec.rb40
1 files changed, 40 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..d1492d638
--- /dev/null
+++ b/spec/models/concerns/account_interactions_spec.rb
@@ -0,0 +1,40 @@
+require 'rails_helper'
+
+describe AccountInteractions do
+	describe 'muting an account' do
+		before do
+			@me = Fabricate(:account, username: 'Me')
+			@you = Fabricate(:account, username: 'You')
+		end
+
+		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
\ No newline at end of file