about summary refs log tree commit diff
path: root/spec/services
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-01-25 11:37:49 +0100
committerThibaut Girka <thib@sitedethib.com>2019-01-25 11:37:49 +0100
commit04e2c673898203683a8a56f4910d07ba0685ed86 (patch)
tree25578e5b80973833f6d25380a1abb32cc116018a /spec/services
parentafec6b43eb856547ccc7083dbb677096d78821bf (diff)
parente1ec3a9f09add8a34b1a77ce217be8e51ebd4936 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'spec/services')
-rw-r--r--spec/services/post_status_service_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/services/post_status_service_spec.rb b/spec/services/post_status_service_spec.rb
index 3774fed6f..680cebbcf 100644
--- a/spec/services/post_status_service_spec.rb
+++ b/spec/services/post_status_service_spec.rb
@@ -36,6 +36,20 @@ RSpec.describe PostStatusService, type: :service do
     expect(status.params['text']).to eq 'Hi future!'
   end
 
+  it 'does not immediately create a status when scheduling a status' do
+    account = Fabricate(:account)
+    media = Fabricate(:media_attachment)
+    future  = Time.now.utc + 2.hours
+
+    status = subject.call(account, text: 'Hi future!', media_ids: [media.id], scheduled_at: future)
+
+    expect(status).to be_a ScheduledStatus
+    expect(status.scheduled_at).to eq future
+    expect(status.params['text']).to eq 'Hi future!'
+    expect(media.reload.status).to be_nil
+    expect(Status.where(text: 'Hi future!').exists?).to be_falsey
+  end
+
   it 'creates response to the original status of boost' do
     boosted_status = Fabricate(:status)
     in_reply_to_status = Fabricate(:status, reblog: boosted_status)