about summary refs log tree commit diff
path: root/spec/lib/activitypub/activity
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-04-27 08:48:21 +0200
committerClaire <claire.github-309c@sitedethib.com>2022-04-27 08:48:21 +0200
commitfc1dd81ea50e3a12ce6a298103a94d2f5445d7d2 (patch)
tree43038bf3550f8f162495dfc8d9cc077ad1da4052 /spec/lib/activitypub/activity
parenta481af15a9b2a7829c2a849906aa4b475ccdbd98 (diff)
parentbf75fba7942574f9b3b126084477693e9cc179c6 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `package.json`:
  Not a real conflict, upstream dependency updated textually too close to a
  glitch-soc-only dependency.
  Updated the upstream dependency.
Diffstat (limited to 'spec/lib/activitypub/activity')
-rw-r--r--spec/lib/activitypub/activity/create_spec.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/spec/lib/activitypub/activity/create_spec.rb b/spec/lib/activitypub/activity/create_spec.rb
index 3e9cbba92..738e644c5 100644
--- a/spec/lib/activitypub/activity/create_spec.rb
+++ b/spec/lib/activitypub/activity/create_spec.rb
@@ -29,6 +29,58 @@ RSpec.describe ActivityPub::Activity::Create do
         subject.perform
       end
 
+      context 'object has been edited' do
+        let(:object_json) do
+          {
+            id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
+            type: 'Note',
+            content: 'Lorem ipsum',
+            published: '2022-01-22T15:00:00Z',
+            updated: '2022-01-22T16:00:00Z',
+          }
+        end
+
+        it 'creates status' do
+          status = sender.statuses.first
+
+          expect(status).to_not be_nil
+          expect(status.text).to eq 'Lorem ipsum'
+        end
+
+        it 'marks status as edited' do
+          status = sender.statuses.first
+
+          expect(status).to_not be_nil
+          expect(status.edited?).to eq true
+        end
+      end
+
+      context 'object has update date equal to creation date' do
+        let(:object_json) do
+          {
+            id: [ActivityPub::TagManager.instance.uri_for(sender), '#bar'].join,
+            type: 'Note',
+            content: 'Lorem ipsum',
+            published: '2022-01-22T15:00:00Z',
+            updated: '2022-01-22T15:00:00Z',
+          }
+        end
+
+        it 'creates status' do
+          status = sender.statuses.first
+
+          expect(status).to_not be_nil
+          expect(status.text).to eq 'Lorem ipsum'
+        end
+
+        it 'does not mark status as edited' do
+          status = sender.statuses.first
+
+          expect(status).to_not be_nil
+          expect(status.edited?).to eq false
+        end
+      end
+
       context 'unknown object type' do
         let(:object_json) do
           {