From 06812af41993a4181cf401f14d761d1f7ea047f1 Mon Sep 17 00:00:00 2001 From: Joakim Antman Date: Fri, 1 Oct 2021 23:00:29 +0300 Subject: [PATCH] Fix Style/MultilineIfModifier issues --- .rubocop_todo.yml | 6 ------ spec/integration/readme_examples_spec.rb | 26 +++++++++++++----------- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index b053b403..0e62a2e6 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -134,12 +134,6 @@ Style/ModuleFunction: - 'lib/jwt/algos.rb' - 'lib/jwt/signature.rb' -# Offense count: 1 -# Cop supports --auto-correct. -Style/MultilineIfModifier: - Exclude: - - 'spec/integration/readme_examples_spec.rb' - # Offense count: 1 # Cop supports --auto-correct. Style/MutableConstant: diff --git a/spec/integration/readme_examples_spec.rb b/spec/integration/readme_examples_spec.rb index 98e0a3dd..a384a44d 100644 --- a/spec/integration/readme_examples_spec.rb +++ b/spec/integration/readme_examples_spec.rb @@ -65,18 +65,20 @@ ] end - it 'RSASSA-PSS' do - rsa_private = OpenSSL::PKey::RSA.generate 2048 - rsa_public = rsa_private.public_key - - token = JWT.encode payload, rsa_private, 'PS256' - decoded_token = JWT.decode token, rsa_public, true, algorithm: 'PS256' - - expect(decoded_token).to eq [ - { 'data' => 'test' }, - { 'alg' => 'PS256' } - ] - end if ::Gem::Version.new(OpenSSL::VERSION) >= ::Gem::Version.new('2.1') + if ::Gem::Version.new(OpenSSL::VERSION) >= ::Gem::Version.new('2.1') + it 'RSASSA-PSS' do + rsa_private = OpenSSL::PKey::RSA.generate 2048 + rsa_public = rsa_private.public_key + + token = JWT.encode payload, rsa_private, 'PS256' + decoded_token = JWT.decode token, rsa_public, true, algorithm: 'PS256' + + expect(decoded_token).to eq [ + { 'data' => 'test' }, + { 'alg' => 'PS256' } + ] + end + end end context 'claims' do