From 5c73567319c2b720a430fb2efe2db9cf0e857446 Mon Sep 17 00:00:00 2001 From: Robert Schulze Date: Fri, 13 Dec 2024 13:07:16 +0100 Subject: [PATCH] Fix spec for ruby 3.4 Ruby 3.4 changed its inspect format. Using JSON.dump for stable format across ruby versions. --- spec/roda/phlex_spec.rb | 2 +- spec/support/views.rb | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/spec/roda/phlex_spec.rb b/spec/roda/phlex_spec.rb index fcd2aa6..6e888d4 100644 --- a/spec/roda/phlex_spec.rb +++ b/spec/roda/phlex_spec.rb @@ -112,7 +112,7 @@ def app it "works" do get "/more", {a: 1, b: 2} - expect(last_response.body).to eq("
{"a"=>"1", "b"=>"2"}
") + expect(last_response.body).to eq("
{"a":"1","b":"2"}
") expect(last_response.media_type).to eq("text/html") end end diff --git a/spec/support/views.rb b/spec/support/views.rb index ed8d58e..01384a7 100644 --- a/spec/support/views.rb +++ b/spec/support/views.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "json" + class FooView < Phlex::HTML def initialize(text = "foo") @text = text @@ -22,7 +24,7 @@ def view_template class MoreDetailsView < Phlex::HTML def view_template - pre { app.request.params.inspect } + pre { JSON.dump(app.request.params) } end end