From 8a965eba191488def5c814c854bb0d126c1d24d1 Mon Sep 17 00:00:00 2001 From: Surinna Curtis Date: Thu, 27 Jul 2017 09:00:29 -0500 Subject: [PATCH] Add specs for how mute! interacts with muting_notifications? --- .../concerns/account_interactions_spec.rb | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 spec/models/concerns/account_interactions_spec.rb diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb new file mode 100644 index 0000000000..d1492d6381 --- /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