From 833ff9c3228229b695c6d2f5d571434058118492 Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:08:02 +0100 Subject: [PATCH 1/7] Fix tests on older Rubies --- test/qr_faktura_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/qr_faktura_test.rb b/test/qr_faktura_test.rb index 2ca9cbd..40d6093 100644 --- a/test/qr_faktura_test.rb +++ b/test/qr_faktura_test.rb @@ -46,7 +46,7 @@ def test_example_2 TD: 0, #!!! SA: 0, #!!! ACC: 'CZ9701000000007098760287+KOMBCZPP', - 'X-SW': 'MoneyS5-1.7.1' + 'X-SW'.to_sym => 'MoneyS5-1.7.1' ) assert_equal 'SID*1.0*ID:2001401154*DD:20140404*TP:9*AM:61189.00*MSG:Dodávka vybavení interiéru hotelu Kamzík*VS:3310001054*VII:CZ25568736*INI:25568736*INR:25568736*VIR:CZ25568736*DUZP:20140404*DT:20140412*TB0:26492.70*T0:5563.47*TB1:25333.10*T1:3799.97*NTB:-0.24*CC:CZK*TD:0*SA:0*ACC:CZ9701000000007098760287+KOMBCZPP*X-SW:MoneyS5-1.7.1*', invoice.to_qr_invoice assert_equal 'SPD*1.0*AM:61189.00*X-VS:3310001054*DT:20140412*CC:CZK*ACC:CZ9701000000007098760287+KOMBCZPP*X-INV:SID%2A1.0%2AID:2001401154%2AMSG:Dodávka vybavení interiéru hotelu Kamzík%2ADD:20140404%2ATP:9%2AVII:CZ25568736%2AINI:25568736%2AINR:25568736%2AVIR:CZ25568736%2ADUZP:20140404%2ADT:20140412%2ATB0:26492.70%2AT0:5563.47%2ATB1:25333.10%2AT1:3799.97%2ANTB:-0.24%2ATD:0%2ASA:0%2AX-SW:MoneyS5-1.7.1*', invoice.to_qr_payment From 47a896914c96ec5d7410118ad821bc9bde0a7ff6 Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:08:40 +0100 Subject: [PATCH 2/7] Add Ruby 2.5 to Travis build --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 2a1af70..c3e7103 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,5 +4,6 @@ rvm: - 1.9.2 - 1.9.3 - 2.0.0 + - 2.5.0 - ree script: bundle exec rake test From b5d9588b8e642760894505677cec661a42817608 Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:20:13 +0100 Subject: [PATCH 3/7] Use older method of transforming Array to Hash --- lib/rspayd/parsers/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rspayd/parsers/base.rb b/lib/rspayd/parsers/base.rb index 0c74796..4489730 100644 --- a/lib/rspayd/parsers/base.rb +++ b/lib/rspayd/parsers/base.rb @@ -10,9 +10,9 @@ class Base def initialize(code) @code = code - @values = code.split(self.class::HEADER)[1].split('*').collect{|i| + @values = Hash[code.split(self.class::HEADER)[1].split('*').collect{|i| i.split(':',2) - }.to_h + }] end def check_keys! From a955c8c612b53da4569890bdf687c533de113a4f Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:26:23 +0100 Subject: [PATCH 4/7] Explicitly set file encodings --- test/parser_test.rb | 1 + test/qr_faktura_test.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/test/parser_test.rb b/test/parser_test.rb index 6199c70..ec481aa 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'test_helper' class ParserTest < MiniTest::Test diff --git a/test/qr_faktura_test.rb b/test/qr_faktura_test.rb index 40d6093..fdbada6 100644 --- a/test/qr_faktura_test.rb +++ b/test/qr_faktura_test.rb @@ -1,3 +1,4 @@ +# -*- encoding : utf-8 -*- require 'test_helper' class QrFakturaTest < MiniTest::Test From 9f486f6c41a9f8a9ae32c4bc6a5c1739db2b2776 Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:36:36 +0100 Subject: [PATCH 5/7] Revert "Explicitly set file encodings" This reverts commit a955c8c612b53da4569890bdf687c533de113a4f. --- test/parser_test.rb | 1 - test/qr_faktura_test.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/test/parser_test.rb b/test/parser_test.rb index ec481aa..6199c70 100644 --- a/test/parser_test.rb +++ b/test/parser_test.rb @@ -1,4 +1,3 @@ -# -*- encoding : utf-8 -*- require 'test_helper' class ParserTest < MiniTest::Test diff --git a/test/qr_faktura_test.rb b/test/qr_faktura_test.rb index fdbada6..40d6093 100644 --- a/test/qr_faktura_test.rb +++ b/test/qr_faktura_test.rb @@ -1,4 +1,3 @@ -# -*- encoding : utf-8 -*- require 'test_helper' class QrFakturaTest < MiniTest::Test From 4db79566ab592a5082b109c6eba34f4b337db491 Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:36:54 +0100 Subject: [PATCH 6/7] Revert "Use older method of transforming Array to Hash" This reverts commit b5d9588b8e642760894505677cec661a42817608. --- lib/rspayd/parsers/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/rspayd/parsers/base.rb b/lib/rspayd/parsers/base.rb index 4489730..0c74796 100644 --- a/lib/rspayd/parsers/base.rb +++ b/lib/rspayd/parsers/base.rb @@ -10,9 +10,9 @@ class Base def initialize(code) @code = code - @values = Hash[code.split(self.class::HEADER)[1].split('*').collect{|i| + @values = code.split(self.class::HEADER)[1].split('*').collect{|i| i.split(':',2) - }] + }.to_h end def check_keys! From 98b0615ffde220ab36dd62ffa53db35ce713559d Mon Sep 17 00:00:00 2001 From: Premysl Donat Date: Sun, 25 Nov 2018 18:37:29 +0100 Subject: [PATCH 7/7] Add 2.1 to Travis build matrix --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c3e7103..8cbe098 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,9 +1,5 @@ language: ruby rvm: - - 1.8.7 - - 1.9.2 - - 1.9.3 - - 2.0.0 + - 2.1.0 - 2.5.0 - - ree script: bundle exec rake test