diff --git a/Gemfile b/Gemfile index deff29a..daf9451 100644 --- a/Gemfile +++ b/Gemfile @@ -8,7 +8,7 @@ gemspec group :quality do gem "caliber", "~> 0.83" - gem "git-lint", "~> 9.0" + gem "git-lint", "~> 10.0" gem "reek", "~> 6.5", require: false gem "simplecov", "~> 0.22", require: false end @@ -18,14 +18,14 @@ group :development do end group :test do - gem "http-fake", "~> 4.2" - gem "refinements", "~> 13.0" + gem "http-fake", "~> 5.0" + gem "refinements", "~> 14.0" gem "rspec", "~> 3.13" end group :tools do gem "amazing_print", "~> 2.0" - gem "debug", "~> 1.10" - gem "irb-kit", "~> 1.1" + gem "debug", "~> 1.11" + gem "irb-kit", "~> 2.0" gem "repl_type_completor", "~> 0.1" end diff --git a/lib/trmnl/api/client.rb b/lib/trmnl/api/client.rb index 8bb00b7..f4875c1 100644 --- a/lib/trmnl/api/client.rb +++ b/lib/trmnl/api/client.rb @@ -21,15 +21,15 @@ module TRMNL ] include Inspectable[ - endpoint_categories: :class, - endpoint_current_screen: :class, - endpoint_display: :class, - endpoint_firmware: :class, - endpoint_ip_addresses: :class, - endpoint_log: :class, - endpoint_models: :class, - endpoint_palettes: :class, - endpoint_setup: :class + endpoint_categories: :type, + endpoint_current_screen: :type, + endpoint_display: :type, + endpoint_firmware: :type, + endpoint_ip_addresses: :type, + endpoint_log: :type, + endpoint_models: :type, + endpoint_palettes: :type, + endpoint_setup: :type ] def initialize(**) diff --git a/lib/trmnl/api/endpoints/category.rb b/lib/trmnl/api/endpoints/category.rb index bc0b966..2921d2c 100644 --- a/lib/trmnl/api/endpoints/category.rb +++ b/lib/trmnl/api/endpoints/category.rb @@ -10,7 +10,7 @@ module TRMNL class Category include TRMNL::API::Dependencies[:requester, contract: "contracts.category"] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call diff --git a/lib/trmnl/api/endpoints/current_screen.rb b/lib/trmnl/api/endpoints/current_screen.rb index ec05bc8..df8cfea 100644 --- a/lib/trmnl/api/endpoints/current_screen.rb +++ b/lib/trmnl/api/endpoints/current_screen.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.current_screen" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call token: diff --git a/lib/trmnl/api/endpoints/display.rb b/lib/trmnl/api/endpoints/display.rb index 0e3e5ea..8fd6d09 100644 --- a/lib/trmnl/api/endpoints/display.rb +++ b/lib/trmnl/api/endpoints/display.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.display" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call token: diff --git a/lib/trmnl/api/endpoints/firmware.rb b/lib/trmnl/api/endpoints/firmware.rb index 5d0b853..228c863 100644 --- a/lib/trmnl/api/endpoints/firmware.rb +++ b/lib/trmnl/api/endpoints/firmware.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.firmware" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call diff --git a/lib/trmnl/api/endpoints/ip_address.rb b/lib/trmnl/api/endpoints/ip_address.rb index 5fe652e..2222819 100644 --- a/lib/trmnl/api/endpoints/ip_address.rb +++ b/lib/trmnl/api/endpoints/ip_address.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.ip_address" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call diff --git a/lib/trmnl/api/endpoints/model.rb b/lib/trmnl/api/endpoints/model.rb index 6cc872b..9733334 100644 --- a/lib/trmnl/api/endpoints/model.rb +++ b/lib/trmnl/api/endpoints/model.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.model" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call diff --git a/lib/trmnl/api/endpoints/palette.rb b/lib/trmnl/api/endpoints/palette.rb index 2ce9564..1de099d 100644 --- a/lib/trmnl/api/endpoints/palette.rb +++ b/lib/trmnl/api/endpoints/palette.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.palette" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call diff --git a/lib/trmnl/api/endpoints/setup.rb b/lib/trmnl/api/endpoints/setup.rb index 2875d06..f6cdb31 100644 --- a/lib/trmnl/api/endpoints/setup.rb +++ b/lib/trmnl/api/endpoints/setup.rb @@ -14,7 +14,7 @@ module TRMNL model: "models.setup" ] - include Inspectable[contract: :class] + include Inspectable[contract: :type] include Pipeable def call id: diff --git a/spec/lib/trmnl/api/client_spec.rb b/spec/lib/trmnl/api/client_spec.rb index 92d501c..10adc4e 100644 --- a/spec/lib/trmnl/api/client_spec.rb +++ b/spec/lib/trmnl/api/client_spec.rb @@ -113,16 +113,16 @@ RSpec.describe TRMNL::API::Client do end describe "#inspect" do - it "answers endpoint classes" do - expect(client.inspect).to include( - "@endpoint_current_screen=TRMNL::API::Endpoints::CurrentScreen, " \ - "@endpoint_display=TRMNL::API::Endpoints::Display, " \ - "@endpoint_firmware=TRMNL::API::Endpoints::Firmware, " \ - "@endpoint_ip_addresses=TRMNL::API::Endpoints::IPAddress, " \ - "@endpoint_log=TRMNL::API::Endpoints::Log, " \ - "@endpoint_models=TRMNL::API::Endpoints::Model, " \ - "@endpoint_palettes=TRMNL::API::Endpoints::Palette, " \ - "@endpoint_setup=TRMNL::API::Endpoints::Setup, " + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection( + endpoint_current_screen: "TRMNL::API::Endpoints::CurrentScreen", + endpoint_display: "TRMNL::API::Endpoints::Display", + endpoint_firmware: "TRMNL::API::Endpoints::Firmware", + endpoint_ip_addresses: "TRMNL::API::Endpoints::IPAddress", + endpoint_log: "TRMNL::API::Endpoints::Log", + endpoint_models: "TRMNL::API::Endpoints::Model", + endpoint_palettes: "TRMNL::API::Endpoints::Palette", + endpoint_setup: "TRMNL::API::Endpoints::Setup" ) end end diff --git a/spec/lib/trmnl/api/endpoints/category_spec.rb b/spec/lib/trmnl/api/endpoints/category_spec.rb index da62928..a8aca9b 100644 --- a/spec/lib/trmnl/api/endpoints/category_spec.rb +++ b/spec/lib/trmnl/api/endpoints/category_spec.rb @@ -58,6 +58,8 @@ RSpec.describe TRMNL::API::Endpoints::Category do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/current_screen_spec.rb b/spec/lib/trmnl/api/endpoints/current_screen_spec.rb index 0070b5c..7a22521 100644 --- a/spec/lib/trmnl/api/endpoints/current_screen_spec.rb +++ b/spec/lib/trmnl/api/endpoints/current_screen_spec.rb @@ -65,6 +65,8 @@ RSpec.describe TRMNL::API::Endpoints::CurrentScreen do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/display_spec.rb b/spec/lib/trmnl/api/endpoints/display_spec.rb index 551df9e..548d06f 100644 --- a/spec/lib/trmnl/api/endpoints/display_spec.rb +++ b/spec/lib/trmnl/api/endpoints/display_spec.rb @@ -71,6 +71,8 @@ RSpec.describe TRMNL::API::Endpoints::Display do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/firmware_spec.rb b/spec/lib/trmnl/api/endpoints/firmware_spec.rb index 68ff0b7..7671787 100644 --- a/spec/lib/trmnl/api/endpoints/firmware_spec.rb +++ b/spec/lib/trmnl/api/endpoints/firmware_spec.rb @@ -59,6 +59,8 @@ RSpec.describe TRMNL::API::Endpoints::Firmware do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/ip_address_spec.rb b/spec/lib/trmnl/api/endpoints/ip_address_spec.rb index 4ca56cd..9298646 100644 --- a/spec/lib/trmnl/api/endpoints/ip_address_spec.rb +++ b/spec/lib/trmnl/api/endpoints/ip_address_spec.rb @@ -61,6 +61,8 @@ RSpec.describe TRMNL::API::Endpoints::IPAddress do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/model_spec.rb b/spec/lib/trmnl/api/endpoints/model_spec.rb index 5dd36ae..c92b15a 100644 --- a/spec/lib/trmnl/api/endpoints/model_spec.rb +++ b/spec/lib/trmnl/api/endpoints/model_spec.rb @@ -110,6 +110,8 @@ RSpec.describe TRMNL::API::Endpoints::Model do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/palette_spec.rb b/spec/lib/trmnl/api/endpoints/palette_spec.rb index 896ef06..2a4c1b2 100644 --- a/spec/lib/trmnl/api/endpoints/palette_spec.rb +++ b/spec/lib/trmnl/api/endpoints/palette_spec.rb @@ -71,6 +71,8 @@ RSpec.describe TRMNL::API::Endpoints::Palette do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/lib/trmnl/api/endpoints/setup_spec.rb b/spec/lib/trmnl/api/endpoints/setup_spec.rb index 897f879..9d9f031 100644 --- a/spec/lib/trmnl/api/endpoints/setup_spec.rb +++ b/spec/lib/trmnl/api/endpoints/setup_spec.rb @@ -65,6 +65,8 @@ RSpec.describe TRMNL::API::Endpoints::Setup do end describe "#inspect" do - it_behaves_like "an inspectable endpoint", described_class.new + it "has inspected attributes" do + expect(described_class.new.inspect).to match_inspection(contract: "Dry::Schema::JSON") + end end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 26ab176..f1ccfb9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -17,6 +17,7 @@ Bundler.require :tools require "dry/monads" require "http/fake" +require "inspectable/rspec/matchers/match_inspection" require "refinements" require "trmnl/api" @@ -25,7 +26,6 @@ SPEC_ROOT = Pathname(__dir__).realpath.freeze using Refinements::Pathname Pathname.require_tree SPEC_ROOT.join("support/shared_contexts") -Pathname.require_tree SPEC_ROOT.join("support/shared_examples") RSpec.configure do |config| config.color = true diff --git a/spec/support/shared_examples/an_inspectable_endpoint.rb b/spec/support/shared_examples/an_inspectable_endpoint.rb deleted file mode 100644 index cd99c90..0000000 --- a/spec/support/shared_examples/an_inspectable_endpoint.rb +++ /dev/null @@ -1,7 +0,0 @@ -# frozen_string_literal: true - -RSpec.shared_examples "an inspectable endpoint" do |target| - it "answers contract class" do - expect(target.inspect).to include("@contract=Dry::Schema::JSON") - end -end diff --git a/trmnl-api.gemspec b/trmnl-api.gemspec index 937f229..77dd562 100644 --- a/trmnl-api.gemspec +++ b/trmnl-api.gemspec @@ -23,16 +23,15 @@ Gem::Specification.new do |spec| spec.required_ruby_version = ">= 4.0" - spec.add_dependency "cogger", "~> 1.4" - spec.add_dependency "containable", "~> 1.2" - spec.add_dependency "dry-monads", "~> 1.8" + spec.add_dependency "cogger", "~> 2.0" + spec.add_dependency "containable", "~> 2.0" + spec.add_dependency "dry-monads", "~> 1.9" spec.add_dependency "dry-schema", "~> 1.14" spec.add_dependency "dry-types", "~> 1.8" spec.add_dependency "http", "~> 5.3" - spec.add_dependency "infusible", "~> 4.3" - spec.add_dependency "inspectable", "~> 0.3" - spec.add_dependency "openssl", "~> 3.3" - spec.add_dependency "pipeable", "~> 1.3" + spec.add_dependency "infusible", "~> 5.0" + spec.add_dependency "inspectable", "~> 1.0" + spec.add_dependency "pipeable", "~> 2.0" spec.add_dependency "zeitwerk", "~> 2.7" spec.extra_rdoc_files = Dir["README*", "LICENSE*"]