about summary refs log tree commit diff
path: root/spec/models
diff options
context:
space:
mode:
Diffstat (limited to 'spec/models')
-rw-r--r--spec/models/account_spec.rb8
-rw-r--r--spec/models/concerns/account_interactions_spec.rb40
2 files changed, 44 insertions, 4 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb
index aef0c3082..361577eff 100644
--- a/spec/models/account_spec.rb
+++ b/spec/models/account_spec.rb
@@ -558,8 +558,8 @@ RSpec.describe Account, type: :model do
         expect(account).to model_have_error_on_field(:display_name)
       end
 
-      it 'is invalid if the note is longer than 160 characters' do
-        account = Fabricate.build(:account, note: Faker::Lorem.characters(161))
+      it 'is invalid if the note is longer than 500 characters' do
+        account = Fabricate.build(:account, note: Faker::Lorem.characters(501))
         account.valid?
         expect(account).to model_have_error_on_field(:note)
       end
@@ -598,8 +598,8 @@ RSpec.describe Account, type: :model do
         expect(account).not_to model_have_error_on_field(:display_name)
       end
 
-      it 'is valid even if the note is longer than 160 characters' do
-        account = Fabricate.build(:account, domain: 'domain', note: Faker::Lorem.characters(161))
+      it 'is valid even if the note is longer than 500 characters' do
+        account = Fabricate.build(:account, domain: 'domain', note: Faker::Lorem.characters(501))
         account.valid?
         expect(account).not_to model_have_error_on_field(:note)
       end
diff --git a/spec/models/concerns/account_interactions_spec.rb b/spec/models/concerns/account_interactions_spec.rb
new file mode 100644
index 000000000..ef957fc1d
--- /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