Skip to content

Commit

Permalink
Use a clearer name for request spec shared context
Browse files Browse the repository at this point in the history
“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.
  • Loading branch information
timriley committed Nov 6, 2023
1 parent 53e65ae commit 9727983
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions lib/hanami/rspec/generators/support_requests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions spec/unit/hanami/rspec/commands/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9727983

Please sign in to comment.