Skip to content

Commit

Permalink
Merge pull request #91 from SonicGarden/0.17.0
Browse files Browse the repository at this point in the history
[review] html_escape設定を必須に
  • Loading branch information
aki77 authored Apr 23, 2024
2 parents 6c5de13 + 87b4fa9 commit a259b48
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["3.0", 3.1, 3.2]
gemfile: ["6.1", "7.0", "main"]
ruby: ["3.0", 3.1, 3.2, 3,3]
gemfile: ["6.1", "7.0", "7.1", "main"]
exclude:
- ruby: "3.0"
gemfile: "main"
- ruby: "3.1"
gemfile: "6.1"
- ruby: "3.2"
gemfile: "6.1"
- ruby: "3.3"
gemfile: "6.1"
steps:
- name: Install packages
run: |
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true,
"source.fixAll.eslint": "explicit"
},
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.preferences.importModuleSpecifier": "non-relative",
Expand Down
5 changes: 5 additions & 0 deletions gemfiles/7.1.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "http://rubygems.org"

gem "rails", "~> 7.1"

gemspec :path => "../"
9 changes: 8 additions & 1 deletion lib/copy_tuner_client/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,20 @@ def initialize
self.upload_disabled_environments = %w[production staging]
self.s3_host = 'copy-tuner-data-prod.s3.amazonaws.com'
self.disable_copyray_comment_injection = false
self.html_escape = false
# TODO: 0.18.0以降のバージョンで初期値をtrueにしたい
self.html_escape = nil
self.ignored_keys = []
self.ignored_key_handler = -> (e) { raise e }

@applied = false
end

def html_escape
raise 'CopyTunerClient.configuration.html_escape is required' if @html_escape.nil?

@html_escape
end

# Allows config options to be read like a hash
#
# @param [Symbol] option Key for a given attribute
Expand Down
2 changes: 1 addition & 1 deletion lib/copy_tuner_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module CopyTunerClient
# Client version
VERSION = '0.16.3'.freeze
VERSION = '0.17.0'.freeze

# API version being used to communicate with the server
API_VERSION = '2.0'.freeze
Expand Down
4 changes: 2 additions & 2 deletions spec/copy_tuner_client/i18n_backend_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def build_backend
expect(cache['en.test.key']).to eq 'default %{interpolate}'
end

it "marks strings as html safe" do
it "dose not mark strings as html safe" do
cache['en.test.key'] = FakeHtmlSafeString.new("Hello")
backend = build_backend
expect(backend.translate('en', 'test.key')).to be_html_safe
expect(backend.translate('en', 'test.key')).to_not be_html_safe
end

it "looks up an array of defaults" do
Expand Down
1 change: 1 addition & 0 deletions spec/support/client_spec_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def reset_config
CopyTunerClient.configure(false) do |config|
config.api_key = 'abc123'
config.s3_host = 'copy-tuner.com'
config.html_escape = true
end
end
end

0 comments on commit a259b48

Please sign in to comment.