Src C0 Coverage Information - Simploco - RCov

lib/codin_rep/set_employee.rb

Name Total Lines Lines of Code Total Coverage Code Coverage
lib/codin_rep/set_employee.rb 63 63
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/command"
23 
24 module CodinRep
25   class SetEmployee < Command
26     SET_COMMAND_CODE = '075h1'.freeze
27     UNSET_COMMAND_CODE = '016j1'.freeze
28     SET_EXPECTED_HEADER = "REP003h1\0".freeze
29     UNSET_EXPECTED_HEADER = "REP003j1\0".freeze
30 
31     def initialize(time, *args)
32       super(*args)
33       @time = time
34     end
35 
36     def generate_command_payload
37       CodinRep::TimeUtil.pack @time
38     end
39 
40     def get_expected_response_size
41       14
42     end
43 
44     def check_response_header
45       unless @response.match(/^#{EXPECTED_HEADER}/)
46         raise UnknownHeader.new @response[0..6], 'set employee', EXPECTED_HEADER
47       end
48     end
49 
50     def get_response_payload
51       @response_payload = @response[7..-1]
52     end
53 
54     def get_data_from_response_payload
55       new_time = nil
56       begin
57         new_time = CodinRep::TimeUtil.unpack @response_payload
58       rescue ArgumentError
59         raise MalformedResponsePayload.new 'set time'
60       end
61       return new_time
62     end
63   end
64 end

Generated on 2016-12-21 13:50:27 -0200 with SimpleCov-RCov 0.2.3