about summary refs log tree commit diff
path: root/spec/lib/activitypub/activity/create_spec.rb
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2019-03-08 01:47:36 +0100
committerGitHub <noreply@github.com>2019-03-08 01:47:36 +0100
commit29a09858f6700c0a6eb17797836589ed0839dec9 (patch)
tree96ac7fbac23d6ca32704c143342b5606523c8cab /spec/lib/activitypub/activity/create_spec.rb
parent38e9c66f34d7054357a3de63834f182734d43d75 (diff)
parentca45198ccbbdde88731f074fcab2b5c9310775c2 (diff)
Merge pull request #945 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/lib/activitypub/activity/create_spec.rb')
-rw-r--r--spec/lib/activitypub/activity/create_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb
index 56c7bfc61..3a1463d95 100644
--- a/spec/lib/activitypub/activity/create_spec.rb
+++ b/spec/lib/activitypub/activity/create_spec.rb
@@ -482,6 +482,28 @@ RSpec.describe ActivityPub::Activity::Create do
           expect(poll.reload.cached_tallies).to eq [1, 0]
         end
       end
+
+      context 'when a vote to an expired local poll' do
+        let(:poll) do
+          poll = Fabricate.build(:poll, options: %w(Yellow Blue), expires_at: 1.day.ago)
+          poll.save(validate: false)
+          poll
+        end
+        let!(:local_status) { Fabricate(:status, owned_poll: poll) }
+
+        let(:object_json) do
+          {
+            id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
+            type: 'Note',
+            name: 'Yellow',
+            inReplyTo: ActivityPub::TagManager.instance.uri_for(local_status)
+          }
+        end
+
+        it 'does not add a vote to the poll' do
+          expect(poll.votes.first).to be_nil
+        end
+      end
     end
 
     context 'when sender is followed by local users' do