From e64bffb13edbc5ab8bc116e6c77f9e54224f8aa4 Mon Sep 17 00:00:00 2001 From: Pedro Furtado Date: Wed, 23 Jun 2021 21:47:11 -0300 Subject: [PATCH] More tests in suite --- lib/qrcode_pix_ruby/payload.rb | 4 +++- qrcode_pix_ruby.gemspec | 1 + spec/qrcode_pix_ruby_spec.rb | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/qrcode_pix_ruby/payload.rb b/lib/qrcode_pix_ruby/payload.rb index 928f8ae..c236bc7 100755 --- a/lib/qrcode_pix_ruby/payload.rb +++ b/lib/qrcode_pix_ruby/payload.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'rqrcode' + module QrcodePixRuby class Payload ID_PAYLOAD_FORMAT_INDICATOR = '00'.freeze @@ -49,7 +51,7 @@ def payload end def base64 - '' + ::RQRCode::QRCode.new(payload).as_png(bit_depth: 1, border_modules: 0, color_mode: 0, color: 'black', file: nil, fill: 'white', module_px_size: 6, resize_exactly_to: false, resize_gte_to: false, size: 200).to_data_url end private diff --git a/qrcode_pix_ruby.gemspec b/qrcode_pix_ruby.gemspec index e747779..3a6d9cd 100755 --- a/qrcode_pix_ruby.gemspec +++ b/qrcode_pix_ruby.gemspec @@ -25,4 +25,5 @@ Gem::Specification.new do |spec| spec.add_dependency 'rake', '~> 13.0' spec.add_dependency 'rspec', '~> 3.0' + spec.add_dependency 'rqrcode', '~> 2.0' end diff --git a/spec/qrcode_pix_ruby_spec.rb b/spec/qrcode_pix_ruby_spec.rb index 6e5b9f8..c34aa15 100755 --- a/spec/qrcode_pix_ruby_spec.rb +++ b/spec/qrcode_pix_ruby_spec.rb @@ -1,7 +1,10 @@ # frozen_string_literal: true RSpec.describe QrcodePixRuby do - it 'QRCode - Base64' + it 'QRCode - Base64' do + pix = QrcodePixRuby::Payload.new + expect(pix.base64).to eq '' + end it 'QRCode - Payload - 01 - Basic' do pix = QrcodePixRuby::Payload.new