diff --git a/decidim-bulletin_board-ruby/CHANGELOG.md b/decidim-bulletin_board-ruby/CHANGELOG.md index 4b64d46a..bcff0084 100644 --- a/decidim-bulletin_board-ruby/CHANGELOG.md +++ b/decidim-bulletin_board-ruby/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.2] - 2020-12-20 + +### Fixed + +- Include the schema definition within the gem to avoid extra trips to the server + ## [0.5.1] - 2020-12-19 ### Fixed diff --git a/decidim-bulletin_board-ruby/spec/fixtures/bb_schema.json b/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/bb_schema.json similarity index 100% rename from decidim-bulletin_board-ruby/spec/fixtures/bb_schema.json rename to decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/bb_schema.json diff --git a/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/client.rb b/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/client.rb index 40b893dc..20e7f8bb 100644 --- a/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/client.rb +++ b/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/graphql/client.rb @@ -7,6 +7,7 @@ module Graphql class Client def self.client @client ||= Graphlient::Client.new(BulletinBoard.server, + schema_path: "lib/decidim/bulletin_board/graphql/bb_schema.json", headers: { "Authorization" => BulletinBoard.api_key }) diff --git a/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/version.rb b/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/version.rb index 23e8132d..27d96ae9 100644 --- a/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/version.rb +++ b/decidim-bulletin_board-ruby/lib/decidim/bulletin_board/version.rb @@ -2,6 +2,6 @@ module Decidim module BulletinBoard - VERSION = "0.5.1" + VERSION = "0.5.2" end end diff --git a/decidim-bulletin_board-ruby/spec/decidim/bulletin_board/graphql/client_spec.rb b/decidim-bulletin_board-ruby/spec/decidim/bulletin_board/graphql/client_spec.rb index 45cb1fdf..bab56c30 100644 --- a/decidim-bulletin_board-ruby/spec/decidim/bulletin_board/graphql/client_spec.rb +++ b/decidim-bulletin_board-ruby/spec/decidim/bulletin_board/graphql/client_spec.rb @@ -8,19 +8,6 @@ module Graphql describe Client do subject { described_class.client } - let(:server) { "https://bb.example.org" } - let(:api_key) { "IUdVVU0OF2qZgYIeJQnQHZPRloOh4srmXFZPPQx7" } - let(:client_url) { subject.instance_variable_get(:@url) } - let(:client_options) { subject.instance_variable_get(:@options) } - - before do - # Decidim::BulletinBoard::Graphql::Client.class_variable_set(@client, nil) - Decidim::BulletinBoard.configure do |config| - config.server = server - config.api_key = api_key - end - end - it "has a client" do expect(subject).not_to be_nil end @@ -29,12 +16,8 @@ module Graphql expect(subject).to be_a Graphlient::Client end - it "uses Bulletin board server as url" do - expect(server).to eql(client_url) - end - - it "uses Bulletin board api key as authorization" do - expect(api_key).to eql(client_options[:headers]["Authorization"]) + it "has a schema" do + expect(subject.schema).to be_a Graphlient::Schema end end end diff --git a/decidim-bulletin_board-ruby/spec/shared/client_context.rb b/decidim-bulletin_board-ruby/spec/shared/client_context.rb index e48d3918..b5f00973 100644 --- a/decidim-bulletin_board-ruby/spec/shared/client_context.rb +++ b/decidim-bulletin_board-ruby/spec/shared/client_context.rb @@ -11,10 +11,6 @@ config.identification_private_key = identification_private_key end - allow(Decidim::BulletinBoard::Graphql::Client).to receive(:client).and_return( - Graphlient::Client.new(server, schema_path: "spec/fixtures/bb_schema.json") - ) - if server.present? if error_response stub_request(:post, server).to_return(status: 500)