From 04aaa14db93c74836208199b92d7bb1d6db785e1 Mon Sep 17 00:00:00 2001 From: Vladimir Krylov Date: Fri, 15 Apr 2016 15:41:57 +0300 Subject: [PATCH] Story#110308584 - update tests of registrar --- app/models/invoice.rb | 2 +- spec/models/registrar_spec.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models/invoice.rb b/app/models/invoice.rb index 425202a4c..5c84fe773 100644 --- a/app/models/invoice.rb +++ b/app/models/invoice.rb @@ -113,7 +113,7 @@ class Invoice < ActiveRecord::Base end def description - "Order nr. #{number}" + read_attribute(__method__).presence || "Order nr. #{number}" end def pdf_name diff --git a/spec/models/registrar_spec.rb b/spec/models/registrar_spec.rb index e754664ac..7483452fa 100644 --- a/spec/models/registrar_spec.rb +++ b/spec/models/registrar_spec.rb @@ -130,6 +130,10 @@ describe Registrar do i.sum.should == BigDecimal.new('240.0') i.due_date.should be_within(0.1).of((Time.zone.now + 30.days).end_of_day) i.description.should == 'add some money' + + @registrar.issue_prepayment_invoice(200) + i = @registrar.invoices.last + i.description.should start_with "Order nr." end it 'should not allaw to use CID as code for leagcy reasons' do