From 1a9f29849d06dbb41a7170a9ca1e0cf0f25070e3 Mon Sep 17 00:00:00 2001 From: Tinco Andringa Date: Thu, 7 Nov 2024 09:59:11 +0100 Subject: [PATCH] fix some links related specs --- spec/conversations_spec.rb | 2 +- spec/links_spec.rb | 24 ++++++++++++------------ spec/topics_spec.rb | 7 ------- 3 files changed, 13 insertions(+), 20 deletions(-) diff --git a/spec/conversations_spec.rb b/spec/conversations_spec.rb index aca7c15..21a72d6 100644 --- a/spec/conversations_spec.rb +++ b/spec/conversations_spec.rb @@ -616,7 +616,7 @@ stub_request(:delete, "#{base_url}/conversations/#{conversation_id}/links"). with( headers: headers). to_return(status: 204, body: nil) - frontapp.delete_tag!(conversation_id, data) + frontapp.remove_conversation_links!(conversation_id, data) end it "can remove conversation followers by id" do diff --git a/spec/links_spec.rb b/spec/links_spec.rb index f72e015..86c9a11 100644 --- a/spec/links_spec.rb +++ b/spec/links_spec.rb @@ -12,7 +12,7 @@ let(:frontapp) { Frontapp::Client.new(auth_token: auth_token) } let(:link_id) { "top_55c8c149" } let(:link_conversations_response) { - %Q{ +<<~JSON { "_pagination": {}, "_links": { @@ -134,10 +134,10 @@ } ] } - } +JSON } let(:links_response) do - %Q{ +<<~JSON { "_pagination": { "next": null @@ -169,31 +169,31 @@ } ] } - } +JSON end let(:get_link_response) do - %Q{ + <<~JSON { - "_links"=>{"self"=>"https://lending-home.api.frontapp.com/links/top_55c8c149"}, + "_links": {"self": "https://lending-home.api.frontapp.com/links/top_55c8c149"}, "id": "top_55c8c149", "name": "123456", "type": "web", "external_url": "https://example.com/something/123456", "link": "https://example.com/something/123456" } - } +JSON end - let(:create_link_response) { - %Q{ + let(:create_link_response) do +<<~JSON { - "_links"=>{"self"=>"https://lending-home.api.frontapp.com/links/top_3ij8h"}, + "_links": {"self": "https://lending-home.api.frontapp.com/links/top_3ij8h"}, "id": "top_3ij8h", "name": "Bla", "type": "web", "external_url": "bla.io", "link": "bla.io" } - } +JSON end it "can get all link conversations" do @@ -225,7 +225,7 @@ stub_request(:post, "#{base_url}/links"). with( body: data.to_json, headers: headers). - to_return(status: 200, body: ) + to_return(status: 200, body: create_link_response) end it "can update a link name" do diff --git a/spec/topics_spec.rb b/spec/topics_spec.rb index 5a0f2f1..5c2ff20 100644 --- a/spec/topics_spec.rb +++ b/spec/topics_spec.rb @@ -136,11 +136,4 @@ } } } - - it "can get all topic conversations" do - stub_request(:get, "#{base_url}/topics/#{topic_id}/conversations"). - with( headers: headers). - to_return(status: 200, body: topic_conversations_response) - frontapp.get_topic_conversations(topic_id) - end end