From 972798308793c1e086cccd687796efe9484c7a8e Mon Sep 17 00:00:00 2001 From: Tim Riley Date: Mon, 6 Nov 2023 20:24:40 +1100 Subject: [PATCH] Use a clearer name for request spec shared context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “Hanami app” was too generic. By using “Rack::Test” here, we make it clearer that this shared context is specific for Rack::Test specs only. --- lib/hanami/rspec/generators/support_requests.rb | 5 +++-- spec/unit/hanami/rspec/commands/install_spec.rb | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/hanami/rspec/generators/support_requests.rb b/lib/hanami/rspec/generators/support_requests.rb index f1c8f9a..b1b7c7e 100644 --- a/lib/hanami/rspec/generators/support_requests.rb +++ b/lib/hanami/rspec/generators/support_requests.rb @@ -2,11 +2,12 @@ require "rack/test" -RSpec.shared_context "Hanami app" do +RSpec.shared_context "Rack::Test" do + # Define the app for Rack::Test requests let(:app) { Hanami.app } end RSpec.configure do |config| config.include Rack::Test::Methods, type: :request - config.include_context "Hanami app", type: :request + config.include_context "Rack::Test", type: :request end diff --git a/spec/unit/hanami/rspec/commands/install_spec.rb b/spec/unit/hanami/rspec/commands/install_spec.rb index 22671eb..1ed09e3 100644 --- a/spec/unit/hanami/rspec/commands/install_spec.rb +++ b/spec/unit/hanami/rspec/commands/install_spec.rb @@ -129,13 +129,14 @@ require "rack/test" - RSpec.shared_context "Hanami app" do + RSpec.shared_context "Rack::Test" do + # Define the app for Rack::Test requests let(:app) { Hanami.app } end RSpec.configure do |config| config.include Rack::Test::Methods, type: :request - config.include_context "Hanami app", type: :request + config.include_context "Rack::Test", type: :request end EOF expect(fs.read("spec/support/requests.rb")).to eq(support_requests)