|
36 | 36 | response = @app.patch("/books/23", "CONTENT_TYPE" => "application/json", "rack.input" => body, lint: true)
|
37 | 37 |
|
38 | 38 | expect(response.status).to eq(200)
|
39 |
| - expect(response.body).to eq(%({:published=>"true", :id=>"23"})) |
| 39 | + |
| 40 | + if RUBY_VERSION < "3.4" |
| 41 | + expect(response.body).to eq(%({:published=>"true", :id=>"23"})) |
| 42 | + else |
| 43 | + expect(response.body).to eq(%({published: "true", id: "23"})) |
| 44 | + end |
40 | 45 | end
|
41 | 46 |
|
42 | 47 | # See https://github.com/hanami/router/issues/124
|
|
45 | 50 | response = @app.patch("/books/23", "CONTENT_TYPE" => "application/json", "rack.input" => body, lint: true)
|
46 | 51 |
|
47 | 52 | expect(response.status).to eq(200)
|
48 |
| - expect(response.body).to eq(%({:id=>"23"})) |
| 53 | + |
| 54 | + if RUBY_VERSION < "3.4" |
| 55 | + expect(response.body).to eq(%({:id=>"23"})) |
| 56 | + else |
| 57 | + expect(response.body).to eq(%({id: "23"})) |
| 58 | + end |
49 | 59 | end
|
50 | 60 |
|
51 | 61 | it "is successful (JSON as array)" do
|
52 | 62 | body = StringIO.new(%(["alpha", "beta"]).encode(Encoding::ASCII_8BIT))
|
53 | 63 | response = @app.patch("/books/23", "CONTENT_TYPE" => "application/json", "rack.input" => body, lint: true)
|
54 | 64 |
|
55 | 65 | expect(response.status).to eq(200)
|
56 |
| - expect(response.body).to eq(%({:_=>["alpha", "beta"], :id=>"23"})) |
| 66 | + |
| 67 | + if RUBY_VERSION < "3.4" |
| 68 | + expect(response.body).to eq(%({:_=>["alpha", "beta"], :id=>"23"})) |
| 69 | + else |
| 70 | + expect(response.body).to eq(%({_: ["alpha", "beta"], id: "23"})) |
| 71 | + end |
57 | 72 | end
|
58 | 73 |
|
59 | 74 | # See https://github.com/hanami/utils/issues/169
|
|
62 | 77 | response = @app.patch("/books/23", "CONTENT_TYPE" => "application/json", "rack.input" => body, lint: true)
|
63 | 78 |
|
64 | 79 | expect(response.status).to eq(200)
|
65 |
| - expect(response.body).to eq(%({:json_class=>"Foo", :id=>"23"})) |
| 80 | + |
| 81 | + if RUBY_VERSION < "3.4" |
| 82 | + expect(response.body).to eq(%({:json_class=>"Foo", :id=>"23"})) |
| 83 | + else |
| 84 | + expect(response.body).to eq(%({json_class: "Foo", id: "23"})) |
| 85 | + end |
66 | 86 | end
|
67 | 87 |
|
68 | 88 | it "is idempotent" do
|
|
71 | 91 | response = @app.patch("/books/23", "CONTENT_TYPE" => "application/json", "rack.input" => body, lint: true)
|
72 | 92 |
|
73 | 93 | expect(response.status).to eq(200)
|
74 |
| - expect(response.body).to eq(%({:published=>"true", :id=>"23"})) |
| 94 | + |
| 95 | + if RUBY_VERSION < "3.4" |
| 96 | + expect(response.body).to eq(%({:published=>"true", :id=>"23"})) |
| 97 | + else |
| 98 | + expect(response.body).to eq(%({published: "true", id: "23"})) |
| 99 | + end |
75 | 100 | end
|
76 | 101 | end
|
77 | 102 | end
|
|
82 | 107 | response = @app.patch("/authors/23", "CONTENT_TYPE" => "application/xml", "rack.input" => body, lint: true)
|
83 | 108 |
|
84 | 109 | expect(response.status).to eq(200)
|
85 |
| - expect(response.body).to eq(%({:name=>"LG", :id=>"23"})) |
| 110 | + |
| 111 | + if RUBY_VERSION < "3.4" |
| 112 | + expect(response.body).to eq(%({:name=>"LG", :id=>"23"})) |
| 113 | + else |
| 114 | + expect(response.body).to eq(%({name: "LG", id: "23"})) |
| 115 | + end |
86 | 116 | end
|
87 | 117 |
|
88 | 118 | it "is successful (XML aliased mime)" do
|
89 | 119 | body = StringIO.new(%(<name>MGF</name>).encode(Encoding::ASCII_8BIT))
|
90 | 120 | response = @app.patch("/authors/15", "CONTENT_TYPE" => "text/xml", "rack.input" => body, lint: true)
|
91 | 121 |
|
92 | 122 | expect(response.status).to eq(200)
|
93 |
| - expect(response.body).to eq(%({:name=>"MGF", :id=>"15"})) |
| 123 | + |
| 124 | + if RUBY_VERSION < "3.4" |
| 125 | + expect(response.body).to eq(%({:name=>"MGF", :id=>"15"})) |
| 126 | + else |
| 127 | + expect(response.body).to eq(%({name: "MGF", id: "15"})) |
| 128 | + end |
94 | 129 | end
|
95 | 130 | end
|
96 | 131 | end
|
0 commit comments