5 files changed +27
-17
lines changed Original file line number Diff line number Diff line change 6
6
strategy :
7
7
fail-fast : false
8
8
matrix :
9
- ruby : [ '3.1', '3.2', '3.3', ' head' ]
9
+ ruby : [ '3.1', '3.2', 'head' ]
10
10
rails : [ '7.1', 'edge' ]
11
+ rubyopt : [""]
11
12
include :
12
- - ruby : ' 2.7'
13
- rails : ' 6.1'
14
- - ruby : ' 3.0'
15
- rails : ' 6.1'
16
- - ruby : ' 3.1'
17
- rails : ' 7.0'
13
+ - ruby : ' 3.3'
14
+ rails : ' 7.1'
15
+ rubyopt : " --enable-frozen-string-literal"
18
16
19
17
env :
20
18
RAILS_VERSION : ${{ matrix.rails }}
19
+ RUBYOPT : ${{ matrix.rubyopt }}
21
20
22
21
steps :
23
- - uses : actions/checkout@v2
22
+ - uses : actions/checkout@v4
24
23
25
24
- name : Set up Ruby
26
25
uses : ruby/setup-ruby@v1
@@ -29,10 +28,10 @@ jobs:
29
28
bundler-cache : true
30
29
31
30
- name : Run unit tests
32
- run : bundle exec rake test:unit
31
+ run : bundle exec rake test:unit RUBYOPT="${{ matrix.rubyopt }}"
33
32
timeout-minutes : 3
34
33
35
34
- name : Run acceptance tests
36
- run : bundle exec rake test:acceptance
35
+ run : bundle exec rake test:acceptance RUBYOPT="${{ matrix.rubyopt }}"
37
36
timeout-minutes : 10
38
37
if : ${{ matrix.rails != 'edge' && matrix.ruby != 'head' }} # Acceptance tests use `gem install rails && rails new`
Original file line number Diff line number Diff line change 1
- # encoding: UTF-8
1
+ # frozen_string_literal: true
2
2
3
3
# ### WHY SPRING VENDORS A JSON LIBRARY ###
4
4
#
13
13
module Spring
14
14
module JSON
15
15
def self . load ( string )
16
- string . force_encoding ( "utf-8" )
17
16
OkJson . decode ( string )
18
17
end
19
18
@@ -364,7 +363,7 @@ def unquote(q)
364
363
end
365
364
end
366
365
if rubydoesenc?
367
- a [ w ] = '' << uchar
366
+ a [ w ] = + '' << uchar
368
367
w += 1
369
368
else
370
369
w += ucharenc ( a , w , uchar )
Original file line number Diff line number Diff line change @@ -12,9 +12,9 @@ class AcceptanceTest < ActiveSupport::TestCase
12
12
13
13
def rails_version
14
14
if ENV [ 'RAILS_VERSION' ] == "edge"
15
- ">= 7.1 .0.alpha"
15
+ ">= 8.0 .0.alpha"
16
16
else
17
- "~> #{ ENV [ 'RAILS_VERSION' ] || "6 .1" } .0"
17
+ "~> #{ ENV [ 'RAILS_VERSION' ] || "7 .1" } .0"
18
18
end
19
19
end
20
20
Original file line number Diff line number Diff line change @@ -168,15 +168,15 @@ def read_streams
168
168
end
169
169
170
170
def read_stream ( stream )
171
- output = ""
171
+ output = + ""
172
172
while IO . select ( [ stream ] , [ ] , [ ] , 0.5 ) && !stream . eof?
173
173
output << stream . readpartial ( 10240 )
174
174
end
175
175
output
176
176
end
177
177
178
178
def dump_streams ( command , streams )
179
- output = "$ #{ command } \n "
179
+ output = + "$ #{ command } \n "
180
180
181
181
streams . each do |name , stream |
182
182
unless stream . chomp . empty?
Original file line number Diff line number Diff line change
1
+ require_relative "../helper"
2
+ require 'spring/json'
3
+
4
+ class JsonTest < ActiveSupport ::TestCase
5
+ test 'can decode unicode characters' do
6
+ assert_equal ( { "unicode_example" => "©" } , Spring ::JSON . load ( '{"unicode_example": "\u00A9"}' ) )
7
+ end
8
+
9
+ test 'can encode' do
10
+ assert_equal ( '{}' , Spring ::JSON . dump ( { } ) )
11
+ end
12
+ end
0 commit comments