Skip to content

Commit a69246a

Browse files
committed
Add Frozen String Literal Magic Comment to tests
Changes have been applied exclusively to non-production code. The CI workflow now runs tests with Ruby’s frozen string literal and debug options enabled. The updates were performed automatically using: ``` rubocop --only Style/FrozenStringLiteralComment,Layout/EmptyLineAfterMagicComment,Style/RedundantFreeze -Am test/**/*.rb ``` An additional modification was made to `RiotTestHelpers.char_split`, where the string is now duplicated before calling `String#force_encoding` to prevent errors related to modifying frozen strings. Ref: #780
1 parent d3cb9ad commit a69246a

28 files changed

+55
-2
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ jobs:
4040
ruby-version: ${{ matrix.ruby-version }}
4141
bundler-cache: true
4242
- name: Run tests
43-
run: bundle exec rake
43+
run: RUBYOPT='--enable=frozen-string-literal --debug=frozen-string-literal' bundle exec rake

test/bson_engine_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require File.expand_path('../teststrap', __FILE__)
24
require 'rabl/template'
35

test/builder_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require File.expand_path('../teststrap', __FILE__)
24

35
context "Rabl::Builder" do

test/configuration_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require File.expand_path('../teststrap', __FILE__)
24

35
context 'Rabl::Configuration' do

test/engine_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'json'
24
require File.expand_path('../teststrap', __FILE__)
35
require 'rabl/template'

test/helpers_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'tmpdir'
24
require 'pathname'
35
require File.expand_path('../teststrap', __FILE__)

test/integration/posts_controller_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Lives in <rabl>/test/integration/posts_controller_test.rb
24
# Symlinked to fixture applications
35

test/integration/rails3_2/posts_controller_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Lives in <rabl>/test/integration/posts_controller_test.rb
24
# Symlinked to fixture applications
35

test/integration/rails3_2/users_controller_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Lives in <rabl>/test/integration/users_controller_test.rb
24
# Symlinked to fixture applications
35

test/integration/rails4/posts_controller_test.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
# Lives in <rabl>/test/integration/posts_controller_test.rb
24
# Symlinked to fixture applications
35

0 commit comments

Comments
 (0)