about summary refs log tree commit diff
path: root/spec
diff options
context:
space:
mode:
authoralpaca-tc <alpaca-tc@alpaca.tc>2017-05-13 22:56:12 +0900
committerEugen Rochko <eugen@zeonfederated.com>2017-05-13 15:56:12 +0200
commite9810cbad61625771c4d0a8de25211795f03d82e (patch)
tree1e0b7c8965ec382061fd926a611696009ff28e95 /spec
parent1027556614febb096f2186d3c678116b415c0b9b (diff)
Fixes NoMethodError: undefined method 'first' for nil:NilClass (#3036)
Diffstat (limited to 'spec')
-rw-r--r--spec/models/status_spec.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb
index b21fcd190..f9f5c1603 100644
--- a/spec/models/status_spec.rb
+++ b/spec/models/status_spec.rb
@@ -179,6 +179,19 @@ RSpec.describe Status, type: :model do
     end
   end
 
+  describe '#ancestors' do
+    it 'ignores deleted records' do
+      first_status = Fabricate(:status, account: bob)
+      second_status = Fabricate(:status, thread: first_status, account: alice)
+
+      # Create cache and delete cached record
+      second_status.ancestors
+      first_status.destroy
+
+      expect(second_status.ancestors).to eq([])
+    end
+  end
+
   describe '#filter_from_context?' do
     pending
   end