Src C0 Coverage Information - Simploco - RCov

lib/codin_rep/add_employee.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/codin_rep/add_employee.rb 47 47
0.00%
0.00%

Key

Code reported as executed by Ruby looks like this...and this: this line is also marked as covered.Lines considered as run by rcov, but not reported by Ruby, look like this,and this: these lines were inferred by rcov (using simple heuristics).Finally, here's a line marked as not executed.

Coverage Details

2 # -*- coding: utf-8 -*-
3 # codin_rep - Gem para acesso de REPs da Telebyte
4 # Copyright (C) 2016  O.S. Systems Softwares Ltda.
5 
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU Affero General Public License as
8 # published by the Free Software Foundation, either version 3 of the
9 # License, or (at your option) any later version.
10 
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU Affero General Public License for more details.
15 
16 # You should have received a copy of the GNU Affero General Public License
17 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
18 
19 # Rua Clóvis Gularte Candiota 132, Pelotas-RS, Brasil.
20 # e-mail: contato@ossystems.com.br
21 
22 require "codin_rep/employee_command"
23 
24 module CodinRep
25   class AddEmployee < EmployeeCommand
26     NAME_MAX_SIZE = 53
27     COMMAND_CODE = "075h1".freeze
28     EXPECTED_HEADER = "REP003h1".freeze
29     REGISTRATION_COMPLETED_HEADER = 'PGREP010h1'.freeze
30 
31     def initialize(registration, pis_number, name, *args)
32       super(*args)
33       @registration = convert_integer_to_byte_string(registration)
34       @pis_number = convert_integer_to_byte_string(pis_number)
35       @name = convert_employee_name(name)
36     end
37 
38     def generate_command_payload
39       "#{@registration}#{@pis_number}#{@name}"
40     end
41 
42     private
43     def convert_employee_name(name)
44       name = name.strip[0..(NAME_MAX_SIZE-1)].strip + "\0"
45       name.ljust(NAME_MAX_SIZE, "\x20")
46     end
47   end
48 end

Generated on 2017-02-21 09:19:39 -0300 with SimpleCov-RCov 0.2.3