From 7e61397186eab5331a9d05b7d2f306cbcc2bccbe Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 3 May 2024 13:36:24 +0530 Subject: [PATCH] fix: linear spec --- spec/lib/linear_spec.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/lib/linear_spec.rb b/spec/lib/linear_spec.rb index 2dd9681ae..210c8bddc 100644 --- a/spec/lib/linear_spec.rb +++ b/spec/lib/linear_spec.rb @@ -2,10 +2,12 @@ require 'rails_helper' describe Linear do let(:api_key) { 'valid_api_key' } + let(:url) { 'https://api.linear.app/graphql' } let(:linear_client) { described_class.new(api_key) } let(:headers) { { 'Content-Type' => 'application/json', 'Authorization' => api_key } } - let(:client) { Graphlient::Client.new('https://swapi-graphql.netlify.app/.netlify/functions/index', schema_path: 'spec/fixtures/linear-schema.json', headers: headers) } + let(:schema) { JSON.parse(File.read('spec/fixtures/linear-schema.json')) } + let(:client) { Graphlient::Client.new(url, schema: Graphlient::Schema.new({ 'data' => schema }, nil), headers: headers) } it 'raises an exception if the API key is absent' do expect { described_class.new(nil) }.to raise_error(ArgumentError, 'Missing Credentials') @@ -28,7 +30,7 @@ describe Linear do context 'when the API response is success' do before do linear_client.instance_variable_set(:@client, client) - stub_request(:post, 'https://swapi-graphql.netlify.app/.netlify/functions/index') + stub_request(:post, url) .to_return(status: 200, body: { data: { teams: { nodes: [{ id: 'team1', name: 'Team One' }] } } }.to_json) end