about summary refs log tree commit diff
path: root/spec/controllers/api/v1/accounts/relationships_controller_spec.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-02-21 23:22:12 +0100
committerGitHub <noreply@github.com>2018-02-21 23:22:12 +0100
commit4bc625166e381da15aea667b968e186c11be0217 (patch)
tree1948470d6180a4f4034efc7264f0429061ff7448 /spec/controllers/api/v1/accounts/relationships_controller_spec.rb
parent61ed133fea80041b354c78b043cec72dd8644101 (diff)
Fix bug in relationships API introduced by #6482 (#6527)
It was merge when it needed to be deep_merge. And added some tests
Diffstat (limited to 'spec/controllers/api/v1/accounts/relationships_controller_spec.rb')
-rw-r--r--spec/controllers/api/v1/accounts/relationships_controller_spec.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/spec/controllers/api/v1/accounts/relationships_controller_spec.rb b/spec/controllers/api/v1/accounts/relationships_controller_spec.rb
index 508415fc8..e0de790c8 100644
--- a/spec/controllers/api/v1/accounts/relationships_controller_spec.rb
+++ b/spec/controllers/api/v1/accounts/relationships_controller_spec.rb
@@ -66,6 +66,28 @@ describe Api::V1::Accounts::RelationshipsController do
         expect(json.second[:requested]).to be false
         expect(json.second[:domain_blocking]).to be false
       end
+
+      it 'returns JSON with correct data on cached requests too' do
+        get :index, params: { id: [simon.id] }
+
+        json = body_as_json
+
+        expect(json).to be_a Enumerable
+        expect(json.first[:following]).to be true
+        expect(json.first[:showing_reblogs]).to be true
+      end
+
+      it 'returns JSON with correct data after change too' do
+        user.account.unfollow!(simon)
+
+        get :index, params: { id: [simon.id] }
+
+        json = body_as_json
+
+        expect(json).to be_a Enumerable
+        expect(json.first[:following]).to be false
+        expect(json.first[:showing_reblogs]).to be false
+      end
     end
   end
 end