From 08b8a869601f811d52e959888f2ccff6877ed0f5 Mon Sep 17 00:00:00 2001 From: blackchestnut Date: Tue, 20 Jun 2023 21:46:10 +0300 Subject: [PATCH] Refactoring #4 and fix tests --- lib/invest_tinkoff/v2/quotation.rb | 2 +- lib/invest_tinkoff/version.rb | 2 +- spec/invest_tinkoff/v2/quotation_spec.rb | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/invest_tinkoff/v2/quotation.rb b/lib/invest_tinkoff/v2/quotation.rb index de5d933..d4a53fa 100644 --- a/lib/invest_tinkoff/v2/quotation.rb +++ b/lib/invest_tinkoff/v2/quotation.rb @@ -10,7 +10,7 @@ def self.create price units = price.to_i nano = ((price.to_d - units) * 1_000_000_000).to_i new( - "#{price.positive? ? '' : '-'}#{units.abs}".to_i, + units, nano ) end diff --git a/lib/invest_tinkoff/version.rb b/lib/invest_tinkoff/version.rb index c4bb0cd..a109eed 100644 --- a/lib/invest_tinkoff/version.rb +++ b/lib/invest_tinkoff/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module InvestTinkoff - VERSION = '0.9.6.6' + VERSION = '0.9.6.7' end diff --git a/spec/invest_tinkoff/v2/quotation_spec.rb b/spec/invest_tinkoff/v2/quotation_spec.rb index 968634a..553c138 100644 --- a/spec/invest_tinkoff/v2/quotation_spec.rb +++ b/spec/invest_tinkoff/v2/quotation_spec.rb @@ -11,7 +11,7 @@ it do is_expected.to have_attributes( - units: '114', + units: 114, nano: 250_000_000 ) end @@ -22,7 +22,7 @@ it do is_expected.to have_attributes( - units: '-200', + units: -200, nano: -200_000_000 ) end @@ -33,7 +33,7 @@ it do is_expected.to have_attributes( - units: '0', + units: 0, nano: 10_000_000 ) end @@ -44,7 +44,7 @@ it do is_expected.to have_attributes( - units: '-0', + units: -0, nano: -10_000_000 ) end @@ -55,7 +55,7 @@ it do is_expected.to have_attributes( - units: '22', + units: 22, nano: 30_000_000 ) end @@ -66,7 +66,7 @@ it do is_expected.to have_attributes( - units: '21', + units: 21, nano: 880_000_000 ) end