Sha256: 11320884258918853e1ed0e6554f8521524a4ad8b55fa68935c4118f42efd734

Contents?: true

Size: 671 Bytes

Versions: 7

Compression:

Stored size: 671 Bytes

Contents

require 'spec_helper'
require 'copy_tuner_client/helper_extension'
require 'copy_tuner_client/copyray'

describe CopyTunerClient::HelperExtension do
  module KeywordArgumentsHelper
    def translate(key, **options)
      "Hello, #{options[:name]}"
    end

    def controller
      nil
    end
  end

  class KeywordArgumentsView
    include KeywordArgumentsHelper
  end

  CopyTunerClient::HelperExtension.hook_translation_helper(KeywordArgumentsHelper, middleware_enabled: true)

  it 'works with keyword argument method' do
    view = KeywordArgumentsView.new
    expect(view.translate('some.key', name: 'World')).to eq '<!--COPYRAY some.key-->Hello, World'
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
copy_tuner_client-0.19.0 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.18.0 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.17.1 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.16.3 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.16.2 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.16.1 spec/copy_tuner_client/helper_extension_spec.rb
copy_tuner_client-0.16.0 spec/copy_tuner_client/helper_extension_spec.rb