From cb11b0ee5ac528d8c44dc194b26398efb25566b7 Mon Sep 17 00:00:00 2001 From: Surinna Curtis Date: Sat, 16 Dec 2017 21:47:29 +0000 Subject: [PATCH] Add failing specs for local_only in API responses. --- .../api/v1/statuses_controller_spec.rb | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/spec/controllers/api/v1/statuses_controller_spec.rb b/spec/controllers/api/v1/statuses_controller_spec.rb index 71c8486933..2f47562479 100644 --- a/spec/controllers/api/v1/statuses_controller_spec.rb +++ b/spec/controllers/api/v1/statuses_controller_spec.rb @@ -59,6 +59,36 @@ RSpec.describe Api::V1::StatusesController, type: :controller do expect(Status.find_by(id: status.id)).to be nil end end + + describe 'the "local_only" property' do + context 'for a local-only status' do + let(:status) { Fabricate(:status, account: user.account, local_only: true) } + + before do + get :show, params: { id: status.id } + end + + let(:status_response) { JSON.parse(response.body) } + + it 'is true' do + expect(status_response["local_only"]).to be true + end + end + + context 'for a non-local-only status' do + let(:status) { Fabricate(:status, account: user.account, local_only: false) } + + before do + get :show, params: { id: status.id } + end + + let(:status_response) { JSON.parse(response.body) } + + it 'is false' do + expect(status_response["local_only"]).to be false + end + end + end end context 'without an oauth token' do