br_nfe 2.1.0 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (257) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +0 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.markdown +264 -106
  6. data/lib/br_nfe/{helper → association}/have_address.rb +1 -1
  7. data/lib/br_nfe/{helper → association}/have_condicao_pagamento.rb +1 -1
  8. data/lib/br_nfe/association/have_destinatario.rb +22 -0
  9. data/lib/br_nfe/association/have_emitente.rb +24 -0
  10. data/lib/br_nfe/base.rb +37 -27
  11. data/lib/br_nfe/condicao_pagamento.rb +2 -0
  12. data/lib/br_nfe/constants.rb +33 -0
  13. data/lib/br_nfe/endereco.rb +10 -0
  14. data/lib/br_nfe/helper/string_methods.rb +4 -0
  15. data/lib/br_nfe/{emitente.rb → person.rb} +11 -7
  16. data/lib/br_nfe/product/base.rb +82 -0
  17. data/lib/br_nfe/product/consulta_status_servico.rb +35 -0
  18. data/lib/br_nfe/product/emitente.rb +8 -0
  19. data/lib/br_nfe/product/gateway/base.rb +62 -0
  20. data/lib/br_nfe/product/gateway/web_service_svrs.rb +39 -0
  21. data/lib/br_nfe/product/value_nf.rb +9 -0
  22. data/lib/br_nfe/product/xml/soap_env.xml.slim +8 -0
  23. data/lib/br_nfe/product/xml/v3_10/XSD/consReciNFe_v3.10.xsd +9 -0
  24. data/lib/br_nfe/product/xml/v3_10/XSD/consSitNFe_v3.10.xsd +9 -0
  25. data/lib/br_nfe/product/xml/v3_10/XSD/consStatServ_v3.10.xsd +9 -0
  26. data/lib/br_nfe/product/xml/v3_10/XSD/enviNFe_v3.10.xsd +9 -0
  27. data/lib/br_nfe/product/xml/v3_10/XSD/inutNFe_v3.10.xsd +9 -0
  28. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsSitNFe_v3.10.xsd +502 -0
  29. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteConsStatServ_v3.10.xsd +98 -0
  30. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteInutNFe_v3.10.xsd +193 -0
  31. data/lib/br_nfe/product/xml/v3_10/XSD/leiauteNFe_v3.10.xsd +6060 -0
  32. data/lib/br_nfe/product/xml/v3_10/XSD/nfe_v3.10.xsd +9 -0
  33. data/lib/br_nfe/product/xml/v3_10/XSD/procInutNFe_v3.10.xsd +9 -0
  34. data/lib/br_nfe/product/xml/v3_10/XSD/procNFe_v3.10.xsd +9 -0
  35. data/lib/br_nfe/product/xml/v3_10/XSD/retConsReciNFe_v3.10.xsd +9 -0
  36. data/lib/br_nfe/product/xml/v3_10/XSD/retConsSitNFe_v3.10.xsd +9 -0
  37. data/lib/br_nfe/product/xml/v3_10/XSD/retConsStatServ_v3.10.xsd +9 -0
  38. data/lib/br_nfe/product/xml/v3_10/XSD/retEnviNFe_v3.10.xsd +9 -0
  39. data/lib/br_nfe/product/xml/v3_10/XSD/retInutNFe_v3.10.xsd +9 -0
  40. data/lib/br_nfe/product/xml/v3_10/XSD/tiposBasico_v3.10.xsd +571 -0
  41. data/lib/br_nfe/product/xml/v3_10/XSD/xmldsig-core-schema_v1.01.xsd +98 -0
  42. data/lib/br_nfe/product/xml/v3_10/consulta_status_servico.xml.slim +4 -0
  43. data/lib/br_nfe/service/association/have_intermediario.rb +26 -0
  44. data/lib/br_nfe/service/association/have_rps.rb +36 -0
  45. data/lib/br_nfe/service/base.rb +24 -20
  46. data/lib/br_nfe/service/betha/v1/cancela_nfse.rb +43 -0
  47. data/lib/br_nfe/service/betha/v1/consulta_lote_rps.rb +20 -6
  48. data/lib/br_nfe/service/betha/v1/consulta_nfs_por_rps.rb +17 -6
  49. data/lib/br_nfe/service/betha/v1/consulta_nfse.rb +16 -5
  50. data/lib/br_nfe/service/betha/v1/consulta_situacao_lote_rps.rb +15 -6
  51. data/lib/br_nfe/service/betha/v1/gateway.rb +4 -0
  52. data/lib/br_nfe/service/betha/v1/recepcao_lote_rps.rb +13 -5
  53. data/lib/br_nfe/service/betha/v1/xml/_tc_identificacao_prestador.xml.slim +3 -0
  54. data/lib/br_nfe/service/betha/v1/xml/_tc_pedido_cancelamento.xml.slim +4 -0
  55. data/lib/br_nfe/service/concerns/rules/cancelamento_nfs.rb +8 -0
  56. data/lib/br_nfe/service/concerns/rules/consulta_nfs_por_rps.rb +1 -1
  57. data/lib/br_nfe/service/concerns/rules/consulta_nfse.rb +5 -2
  58. data/lib/br_nfe/service/concerns/values_ts/service_v1.rb +319 -0
  59. data/lib/br_nfe/service/destinatario.rb +7 -0
  60. data/lib/br_nfe/service/emitente.rb +8 -0
  61. data/lib/br_nfe/service/intermediario.rb +1 -12
  62. data/lib/br_nfe/service/item.rb +7 -7
  63. data/lib/br_nfe/service/response/build/base.rb +166 -0
  64. data/lib/br_nfe/service/response/build/cancelamento.rb +62 -0
  65. data/lib/br_nfe/service/response/build/consulta_lote_rps.rb +25 -0
  66. data/lib/br_nfe/service/response/build/consulta_nfs_por_rps.rb +25 -0
  67. data/lib/br_nfe/service/response/build/consulta_nfse.rb +24 -0
  68. data/lib/br_nfe/service/response/build/consulta_situacao_lote_rps.rb +56 -0
  69. data/lib/br_nfe/service/response/build/invoice_build.rb +359 -0
  70. data/lib/br_nfe/service/response/build/recepcao_lote_rps.rb +69 -0
  71. data/lib/br_nfe/service/response/cancelamento.rb +22 -0
  72. data/lib/br_nfe/service/response/consulta_lote_rps.rb +18 -0
  73. data/lib/br_nfe/service/response/consulta_nfs_por_rps.rb +10 -0
  74. data/lib/br_nfe/service/response/consulta_nfse.rb +10 -0
  75. data/lib/br_nfe/service/response/consulta_situacao_lote_rps.rb +74 -0
  76. data/lib/br_nfe/service/response/default.rb +93 -0
  77. data/lib/br_nfe/{response/service → service/response}/nota_fiscal.rb +19 -12
  78. data/lib/br_nfe/service/response/paths/v1/tc_nfse.rb +275 -0
  79. data/lib/br_nfe/service/response/recepcao_lote_rps.rb +35 -0
  80. data/lib/br_nfe/service/rps.rb +30 -27
  81. data/lib/br_nfe/service/sc/florianopolis/xml/_service_item.xml.slim +4 -4
  82. data/lib/br_nfe/service/sc/florianopolis/xml/inf_requisicao.xml.slim +4 -4
  83. data/lib/br_nfe/service/simpliss/v1/cancela_nfse.rb +16 -6
  84. data/lib/br_nfe/service/simpliss/v1/consulta_lote_rps.rb +20 -12
  85. data/lib/br_nfe/service/simpliss/v1/consulta_nfs_por_rps.rb +21 -6
  86. data/lib/br_nfe/service/simpliss/v1/consulta_nfse.rb +20 -6
  87. data/lib/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps.rb +17 -6
  88. data/lib/br_nfe/service/simpliss/v1/recepcao_lote_rps.rb +16 -4
  89. data/lib/br_nfe/service/simpliss/v1/xml/_tc_item_servico.xml.slim +2 -2
  90. data/lib/br_nfe/service/thema/v1/cancela_nfse.rb +21 -19
  91. data/lib/br_nfe/service/thema/v1/consulta_lote_rps.rb +21 -19
  92. data/lib/br_nfe/service/thema/v1/consulta_nfs_por_rps.rb +25 -18
  93. data/lib/br_nfe/service/thema/v1/consulta_nfse.rb +20 -20
  94. data/lib/br_nfe/service/thema/v1/consulta_situacao_lote_rps.rb +14 -20
  95. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps.rb +11 -16
  96. data/lib/br_nfe/service/thema/v1/recepcao_lote_rps_limitado.rb +8 -6
  97. data/lib/br_nfe/service/xml/v1/_tc_identificacao_nfse.xml.slim +1 -1
  98. data/lib/br_nfe/service/xml/v1/_tc_pedido_cancelamento.xml.slim +1 -1
  99. data/lib/br_nfe/service/xml/v1/_tc_valores.xml.slim +11 -11
  100. data/lib/br_nfe/version.rb +1 -1
  101. data/lib/br_nfe.rb +62 -62
  102. data/test/br_nfe/association/have_address_test.rb +64 -0
  103. data/test/br_nfe/association/have_condicao_pagamento_test.rb +75 -0
  104. data/test/br_nfe/association/have_destinatario_test.rb +76 -0
  105. data/test/br_nfe/association/have_emitente_test.rb +80 -0
  106. data/test/br_nfe/base_test.rb +96 -61
  107. data/test/br_nfe/endereco_test.rb +21 -0
  108. data/test/br_nfe/person_test.rb +55 -0
  109. data/test/br_nfe/product/base_test.rb +150 -0
  110. data/test/br_nfe/product/consulta_status_servico_test.rb +59 -0
  111. data/test/br_nfe/product/emitente_test.rb +29 -0
  112. data/test/br_nfe/product/gateway/base_test.rb +16 -0
  113. data/test/br_nfe/product/gateway/web_service_svrs_test.rb +36 -0
  114. data/test/br_nfe/service/association/have_intermediario_test.rb +80 -0
  115. data/test/br_nfe/service/association/have_rps_test.rb +62 -0
  116. data/test/br_nfe/service/base_test.rb +42 -42
  117. data/test/br_nfe/service/betha/v1/cancela_nfse_test.rb +90 -0
  118. data/test/br_nfe/service/betha/v1/consulta_lote_rps_test.rb +105 -5
  119. data/test/br_nfe/service/betha/v1/consulta_nfs_por_rps_test.rb +103 -5
  120. data/test/br_nfe/service/betha/v1/consulta_nfse_test.rb +114 -5
  121. data/test/br_nfe/service/betha/v1/consulta_situacao_lote_rps_test.rb +118 -5
  122. data/test/br_nfe/service/betha/v1/gateway_test.rb +1 -1
  123. data/test/br_nfe/service/betha/v1/recepcao_lote_rps_test.rb +51 -5
  124. data/test/br_nfe/service/concerns/rules/cancelamento_nfs_test.rb +2 -2
  125. data/test/br_nfe/service/concerns/rules/consulta_nfs_por_rps_test.rb +2 -7
  126. data/test/br_nfe/service/concerns/rules/consulta_nfse_test.rb +24 -3
  127. data/test/br_nfe/service/concerns/rules/recepcao_lote_rps_test.rb +1 -1
  128. data/test/br_nfe/{helper → service/concerns}/values_ts/service_v1_test.rb +2 -2
  129. data/test/br_nfe/{destinatario_test.rb → service/destinatario_test.rb} +3 -4
  130. data/test/br_nfe/service/emitente_test.rb +29 -0
  131. data/test/br_nfe/service/item_test.rb +14 -14
  132. data/test/br_nfe/service/response/build/base_test.rb +80 -0
  133. data/test/br_nfe/{response/service → service/response}/default_test.rb +1 -82
  134. data/test/br_nfe/service/response/nota_fiscal_test.rb +59 -0
  135. data/test/br_nfe/{response/service → service/response}/paths/v1/tc_nfse_test.rb +10 -10
  136. data/test/br_nfe/service/rps_test.rb +107 -138
  137. data/test/br_nfe/service/sc/florianopolis/emission_rps_test.rb +9 -9
  138. data/test/br_nfe/service/simpliss/v1/base_test.rb +1 -1
  139. data/test/br_nfe/service/simpliss/v1/cancela_nfse_test.rb +7 -10
  140. data/test/br_nfe/service/simpliss/v1/consulta_lote_rps_test.rb +11 -18
  141. data/test/br_nfe/service/simpliss/v1/consulta_nfs_por_rps_test.rb +11 -18
  142. data/test/br_nfe/service/simpliss/v1/consulta_nfse_test.rb +11 -18
  143. data/test/br_nfe/service/simpliss/v1/consulta_situacao_lote_rps_test.rb +7 -11
  144. data/test/br_nfe/service/simpliss/v1/recepcao_lote_rps_test.rb +3 -9
  145. data/test/br_nfe/service/thema/v1/base_test.rb +1 -1
  146. data/test/br_nfe/service/thema/v1/cancela_nfse_test.rb +7 -14
  147. data/test/br_nfe/service/thema/v1/consulta_lote_rps_test.rb +6 -17
  148. data/test/br_nfe/service/thema/v1/consulta_nfs_por_rps_test.rb +6 -13
  149. data/test/br_nfe/service/thema/v1/consulta_nfse_test.rb +11 -18
  150. data/test/br_nfe/service/thema/v1/consulta_situacao_lote_rps_test.rb +7 -11
  151. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_limitado_test.rb +1 -5
  152. data/test/br_nfe/service/thema/v1/recepcao_lote_rps_test.rb +3 -9
  153. data/test/factories/base.rb +0 -1
  154. data/test/factories/{emitente.rb → person.rb} +1 -1
  155. data/test/factories/product/base.rb +12 -0
  156. data/test/factories/product/consulta_status_servico.rb +12 -0
  157. data/test/factories/product/emitente.rb +15 -0
  158. data/test/factories/product/gateway/base.rb +5 -0
  159. data/test/factories/product/gateway/web_service_svrs.rb +5 -0
  160. data/test/factories/service/betha/v1/{cancelamento_nfs.rb → cancela_nfse.rb} +2 -1
  161. data/test/factories/service/betha/v1/consulta_lote_rps.rb +1 -1
  162. data/test/factories/service/betha/v1/consulta_nfs_por_rps.rb +1 -1
  163. data/test/factories/service/betha/v1/consulta_nfse.rb +1 -1
  164. data/test/factories/service/betha/v1/consulta_situacao_lote_rps.rb +1 -1
  165. data/test/factories/{destinatario.rb → service/destinatario.rb} +1 -1
  166. data/test/factories/service/emitente.rb +15 -0
  167. data/test/factories/service/item.rb +4 -4
  168. data/test/factories/service/response/build_response.rb +5 -0
  169. data/test/factories/service/response/default.rb +6 -0
  170. data/test/factories/{response/service → service/response}/nota_fiscal.rb +8 -8
  171. data/test/factories/service/rps.rb +11 -11
  172. data/test/factories/service/sc/florianopolis/base.rb +1 -1
  173. data/test/factories/service/sc/florianopolis/cancellation.rb +1 -1
  174. data/test/factories/service/sc/florianopolis/emission_rps.rb +1 -1
  175. data/test/factories/service/simpliss/v1/base.rb +1 -1
  176. data/test/factories/service/simpliss/v1/cancela_nfse.rb +1 -1
  177. data/test/factories/service/simpliss/v1/consulta_lote_rps.rb +1 -1
  178. data/test/factories/service/simpliss/v1/consulta_nfs_por_rps.rb +1 -1
  179. data/test/factories/service/simpliss/v1/consulta_nfse.rb +1 -1
  180. data/test/factories/service/simpliss/v1/consulta_situacao_lote_rps.rb +1 -1
  181. data/test/factories/service/simpliss/v1/recepcao_lote_rps.rb +1 -1
  182. data/test/factories/service/thema/v1/base.rb +1 -1
  183. data/test/factories/service/thema/v1/cancela_nfse.rb +1 -1
  184. data/test/factories/service/thema/v1/consulta_lote_rps.rb +1 -1
  185. data/test/factories/service/thema/v1/consulta_nfs_por_rps.rb +1 -1
  186. data/test/factories/service/thema/v1/consulta_nfse.rb +1 -1
  187. data/test/factories/service/thema/v1/consulta_situacao_lote_rps.rb +1 -1
  188. data/test/factories/service/thema/v1/recepcao_lote_rps.rb +1 -1
  189. data/test/fixtures/service/response/betha/v1/cancela_nfse/fault.xml +17 -0
  190. data/test/fixtures/service/response/betha/v1/cancela_nfse/success.xml +48 -0
  191. data/test/fixtures/service/response/betha/v1/consulta_lote_rps/fault.xml +18 -0
  192. data/test/fixtures/service/response/betha/v1/consulta_lote_rps/success.xml +108 -0
  193. data/test/fixtures/service/response/betha/v1/consulta_nfse/fault.xml +18 -0
  194. data/test/fixtures/service/response/betha/v1/consulta_nfse/nfs_empty.xml +12 -0
  195. data/test/fixtures/service/response/betha/v1/consulta_nfse/success.xml +115 -0
  196. data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/fault.xml +18 -0
  197. data/test/fixtures/service/response/betha/v1/consulta_nfse_por_rps/success.xml +103 -0
  198. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/error.xml +13 -0
  199. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/fault.xml +17 -0
  200. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/success.xml +13 -0
  201. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed.xml +13 -0
  202. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unprocessed_by_code_error.xml +17 -0
  203. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived.xml +13 -0
  204. data/test/fixtures/service/response/betha/v1/consulta_situacao_lote_rps/unreceived_by_code_error.xml +17 -0
  205. data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/error.xml +17 -0
  206. data/test/fixtures/service/response/betha/v1/recepcao_lote_rps/success.xml +14 -0
  207. metadata +160 -94
  208. data/lib/br_nfe/destinatario.rb +0 -26
  209. data/lib/br_nfe/helper/have_destinatario.rb +0 -18
  210. data/lib/br_nfe/helper/have_emitente.rb +0 -20
  211. data/lib/br_nfe/helper/have_intermediario.rb +0 -24
  212. data/lib/br_nfe/helper/have_rps.rb +0 -34
  213. data/lib/br_nfe/helper/values_ts/service_v1.rb +0 -317
  214. data/lib/br_nfe/response/service/build_response.rb +0 -463
  215. data/lib/br_nfe/response/service/default.rb +0 -185
  216. data/lib/br_nfe/response/service/paths/base.rb +0 -127
  217. data/lib/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta.rb +0 -22
  218. data/lib/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta.rb +0 -25
  219. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta.rb +0 -25
  220. data/lib/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta.rb +0 -25
  221. data/lib/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
  222. data/lib/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta.rb +0 -36
  223. data/lib/br_nfe/response/service/paths/v1/tc_nfse.rb +0 -271
  224. data/lib/br_nfe/service/betha/v1/cancelamento_nfs.rb +0 -36
  225. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -23
  226. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -21
  227. data/lib/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -21
  228. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -22
  229. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_lote_rps_resposta.rb +0 -25
  230. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_resposta.rb +0 -25
  231. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -25
  232. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_consultar_situacao_lote_rps_resposta.rb +0 -31
  233. data/lib/br_nfe/service/simpliss/v1/response_paths/servico_enviar_lote_rps_resposta.rb +0 -36
  234. data/lib/br_nfe/service/thema/v1/response_paths/servico_cancelar_nfse_resposta.rb +0 -17
  235. data/lib/br_nfe/service/thema/v1/response_paths/servico_consultar_nfse_rps_resposta.rb +0 -19
  236. data/test/br_nfe/emitente_test.rb +0 -46
  237. data/test/br_nfe/helper/have_address_test.rb +0 -62
  238. data/test/br_nfe/helper/have_condicao_pagamento_test.rb +0 -71
  239. data/test/br_nfe/helper/have_destinatario_test.rb +0 -64
  240. data/test/br_nfe/helper/have_emitente_test.rb +0 -63
  241. data/test/br_nfe/helper/have_intermediario_test.rb +0 -77
  242. data/test/br_nfe/helper/have_rps_test.rb +0 -59
  243. data/test/br_nfe/response/service/build_response_test.rb +0 -205
  244. data/test/br_nfe/response/service/nota_fiscal_test.rb +0 -41
  245. data/test/br_nfe/response/service/paths/base_test.rb +0 -196
  246. data/test/br_nfe/response/service/paths/v1/servico_cancelar_nfse_resposta_test.rb +0 -25
  247. data/test/br_nfe/response/service/paths/v1/servico_consultar_lote_rps_resposta_test.rb +0 -30
  248. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_resposta_test.rb +0 -30
  249. data/test/br_nfe/response/service/paths/v1/servico_consultar_nfse_rps_resposta_test.rb +0 -30
  250. data/test/br_nfe/response/service/paths/v1/servico_consultar_situacao_lote_rps_resposta_test.rb +0 -30
  251. data/test/br_nfe/response/service/paths/v1/servico_enviar_lote_rps_resposta_test.rb +0 -34
  252. data/test/br_nfe/service/betha/v1/cancelamento_nfs_test.rb +0 -54
  253. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_lote_rps_resposta_test.rb +0 -16
  254. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_resposta_test.rb +0 -16
  255. data/test/br_nfe/service/betha/v1/response_paths/servico_consultar_nfse_rps_resposta_test.rb +0 -16
  256. data/test/factories/response/service/build_response.rb +0 -5
  257. data/test/factories/response/service/default.rb +0 -10
@@ -1,205 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Response::Service::BuildResponse do
4
- subject { FactoryGirl.build(:service_build_response) }
5
- let(:response) { FactoryGirl.build(:response_service_default) }
6
-
7
- describe "#initialize" do
8
- it "ao inicializar deve chamar o metodo include_module! depois de setar os atributos" do
9
- BrNfe::Response::Service::BuildResponse.any_instance.expects(:assign_attributes).in_sequence(sequence_1)
10
- BrNfe::Response::Service::BuildResponse.new(nfe_xml_path: 'path')
11
- end
12
- end
13
-
14
- describe "#response" do
15
- it "Deve instanciar se setar na variavel @response um objeto da classe BrNfe::Response::Service::Default" do
16
- response
17
- subject.stubs(:message_errors_path).returns('message_errors_path')
18
- subject.stubs(:get_message_for_path).with('message_errors_path').returns('get_message_for_path')
19
- subject.stubs(:get_invoices).returns('get_invoices')
20
- subject.stubs(:get_protocol).returns('get_protocol')
21
- subject.stubs(:get_received_date).returns('get_received_date')
22
- subject.stubs(:get_lot_number).returns('get_lot_number')
23
- subject.stubs(:get_situation).returns('get_situation')
24
- subject.stubs(:savon_response).returns(stub(xml: 'savon_response'))
25
- subject.stubs(:get_cancelation_date_time).returns('get_cancelation_date_time')
26
- BrNfe::Response::Service::Default.expects(:new).with({
27
- error_messages: 'get_message_for_path',
28
- notas_fiscais: 'get_invoices',
29
- protocolo: 'get_protocol',
30
- data_recebimento: 'get_received_date',
31
- numero_lote: 'get_lot_number',
32
- situation: 'get_situation',
33
- original_xml: 'savon_response',
34
- cancelation_date_time: 'get_cancelation_date_time'
35
- }).returns(response)
36
- subject.response.must_equal response
37
- subject.instance_variable_get(:@response).must_equal response
38
- end
39
- it "se já tem valor setado em @response não deve instanciar um novo" do
40
- subject.instance_variable_set(:@response, response)
41
- BrNfe::Response::Service::Default.expects(:new).never
42
- subject.response.must_equal response
43
- end
44
- end
45
-
46
- describe "#find_value_for_keys" do
47
- let(:var_hash) { {lvl1: {lvl2: {lvl3: 'value' } } } }
48
-
49
- it "deve retornar o valor do hash quando encontra-lo" do
50
- subject.find_value_for_keys(var_hash, [:lvl1, :lvl2, :lvl3]).must_equal 'value'
51
- end
52
- it "Se as chaves não exisitrem deve retornar nil" do
53
- subject.find_value_for_keys(var_hash, [:lvl1, :noexist, :lvl4]).must_be_nil
54
- end
55
- it "o valor da chave não for um hash e ainda não terminar o loop não deve dar erro" do
56
- subject.find_value_for_keys(var_hash, [:lvl1, :lvl2, :lvl3, :lvl4]).must_be_nil
57
- end
58
- it "pode retornar um hash se o ultimo valor for Hash" do
59
- subject.find_value_for_keys(var_hash, [:lvl1, :lvl2]).must_equal({lvl3: 'value'})
60
- end
61
- it "se não passar apenas uma chave sem array deve retorar o valor da chave" do
62
- subject.find_value_for_keys(var_hash, :lvl1).must_equal({lvl2: {lvl3: 'value'}})
63
- end
64
- end
65
-
66
- describe "#path_with_root" do
67
- it "deve concatenar o array do parametro com o Array do root path" do
68
- subject.keys_root_path = [:root_path]
69
- subject.path_with_root([:child, :child2]).must_equal([:root_path, :child, :child2])
70
- end
71
- it "se o path do params estiver em branco deve retornar nil" do
72
- subject.keys_root_path = [:root_path]
73
- subject.path_with_root([]).must_be_nil
74
- end
75
- end
76
-
77
- describe "#get_message_for_path" do
78
- before do
79
- subject.stubs(:savon_body).returns(:savon_body)
80
- subject.stubs(:path_with_root).with(:msg_path).returns([:msg, :path])
81
- end
82
- it "Quando ao procurar a mensagem retornar um Hash deve buscar a msg pelo metodo get_message_for_hash" do
83
- subject.expects(:find_value_for_keys).with(:savon_body, [:msg, :path]).returns({message: 'ok'}).in_sequence(sequence_1)
84
- subject.expects(:get_message_for_hash).with({message: 'ok'}).returns("MSG")
85
-
86
- subject.get_message_for_path(:msg_path).must_equal ['MSG']
87
- end
88
- it "Quando ao procurar a mensagem retornar um Array deve buscar as msgs do array pelo metodo get_message_for_hash" do
89
- subject.expects(:find_value_for_keys).with(:savon_body, [:msg, :path]).returns([{msg: 1},{msg: 2}]).in_sequence(sequence_1)
90
- subject.expects(:get_message_for_hash).with({msg: 1}).returns("MSG1").in_sequence(sequence_1)
91
- subject.expects(:get_message_for_hash).with({msg: 2}).returns("MSG2").in_sequence(sequence_1)
92
-
93
- subject.get_message_for_path(:msg_path).must_equal ['MSG1','MSG2']
94
- end
95
- it "Quando ao procurar a mensagem retornar uma String deve add a string na msg" do
96
- subject.expects(:find_value_for_keys).with(:savon_body, [:msg, :path]).returns('MESSAGE').in_sequence(sequence_1)
97
- subject.expects(:get_message_for_hash).never
98
-
99
- subject.get_message_for_path(:msg_path).must_equal ['MESSAGE']
100
- end
101
- end
102
-
103
- describe "#get_message_for_hash" do
104
- it "deve retornar um Hash com :code, :message e :solution que devem ser encontradas no has do parametro" do
105
- subject.stubs(:message_code_key).returns(:codigo)
106
- subject.stubs(:message_msg_key).returns(:mensagem)
107
- subject.stubs(:message_solution_key).returns(:solucao)
108
- result = subject.get_message_for_hash({codigo: 'CODE', mensagem: 'Mensagem de erro', solucao: "Solução"})
109
- result.must_equal({
110
- code: 'CODE',
111
- message: 'Mensagem de erro',
112
- solution: 'Solução'
113
- })
114
- end
115
- end
116
-
117
- describe "#get_invoices" do
118
- before do
119
- subject.stubs(:savon_body).returns(:savon_body)
120
- subject.stubs(:invoices_path).returns([:invoice, :path])
121
- subject.stubs(:path_with_root).with([:invoice, :path]).returns([:inv, :path])
122
- end
123
- it "Quando ao procurar a nota fiscal retornar um Hash deve instanciar a nf pelo metodo instance_invoice" do
124
- subject.expects(:find_value_for_keys).with(:savon_body, [:inv, :path]).returns({invoice: 123})
125
- subject.expects(:instance_invoice).with({invoice: 123}).returns(:invoice)
126
-
127
- subject.get_invoices.must_equal [:invoice]
128
- end
129
-
130
- it "Quando ao procurar a nota fiscal retornar um Array deve instanciar as nfs pelo metodo instance_invoice" do
131
- subject.expects(:find_value_for_keys).with(:savon_body, [:inv, :path]).returns([{invoice: 1}, {invoice: 2}]).in_sequence(sequence_1)
132
- subject.expects(:instance_invoice).with({invoice: 1}).returns(:invoice1).in_sequence(sequence_1)
133
- subject.expects(:instance_invoice).with({invoice: 2}).returns(:invoice2).in_sequence(sequence_1)
134
- subject.get_invoices.must_equal [:invoice1, :invoice2]
135
- end
136
-
137
- describe "#get_protocol" do
138
- it "deve buscar o numero do protocolo a partir do caminho em protocol_path" do
139
- subject.stubs(:savon_body).returns(:savon_body)
140
- subject.stubs(:protocol_path).returns(:protocol_path)
141
- subject.stubs(:path_with_root).with(:protocol_path).returns([:path, :root])
142
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('13546')
143
-
144
- subject.send(:get_protocol).must_equal '13546'
145
- end
146
- end
147
-
148
- describe "#get_situation" do
149
- context "deve buscar a situação a partir do caminho em situation_path" do
150
- it "se encontrar a situação deve buscar formatar seu valor através do método #situation_key_values" do
151
- subject.stubs(:savon_body).returns(:savon_body)
152
- subject.stubs(:situation_path).returns(:situation_path)
153
- subject.stubs(:path_with_root).with(:situation_path).returns([:path, :root])
154
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('1').in_sequence(sequence_1)
155
- subject.expects(:situation_key_values).returns({'1'=> :v1, '2'=> :v2}).in_sequence(sequence_1)
156
- subject.send(:get_situation).must_equal :v1
157
- end
158
- it "se não encontrar a situação não deve buscar seu valor através do método #situation_key_values" do
159
- subject.stubs(:savon_body).returns(:savon_body)
160
- subject.stubs(:situation_path).returns(:situation_path)
161
- subject.stubs(:path_with_root).with(:situation_path).returns([:path, :root])
162
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('')
163
- subject.expects(:situation_key_values).never
164
- subject.send(:get_situation).must_equal ''
165
- end
166
- end
167
- end
168
-
169
- describe "#get_received_date" do
170
- it "deve buscar a data de recebimento a partir do caminho em received_date_path" do
171
- subject.stubs(:savon_body).returns(:savon_body)
172
- subject.stubs(:received_date_path).returns(:received_date_path)
173
- subject.stubs(:path_with_root).with(:received_date_path).returns([:path, :root])
174
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('1')
175
-
176
- subject.send(:get_received_date).must_equal '1'
177
- end
178
- end
179
-
180
- describe "#get_lot_number" do
181
- it "deve buscar o numero do lote a partir do caminho em lot_number_path" do
182
- subject.stubs(:savon_body).returns(:savon_body)
183
- subject.stubs(:lot_number_path).returns(:lot_number_path)
184
- subject.stubs(:path_with_root).with(:lot_number_path).returns([:path, :root])
185
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('777')
186
-
187
- subject.send(:get_lot_number).must_equal '777'
188
- end
189
- end
190
-
191
- describe "#get_cancelation_date_time" do
192
- it "deve buscar o numero do lote a partir do caminho em cancelation_date_time_path" do
193
- subject.stubs(:savon_body).returns(:savon_body)
194
- subject.stubs(:cancelation_date_time_path).returns(:cancelation_date_time_path)
195
- subject.stubs(:path_with_root).with(:cancelation_date_time_path).returns([:path, :root])
196
- subject.expects(:find_value_for_keys).with(:savon_body, [:path, :root]).returns('777')
197
-
198
- subject.send(:get_cancelation_date_time).must_equal '777'
199
- end
200
- end
201
-
202
- # O método instance invoice e demais são testados dando o build no XML das NFSs
203
- end
204
-
205
- end
@@ -1,41 +0,0 @@
1
- require 'test_helper'
2
- require 'br_nfe/helper/have_emitente_test'
3
- require 'br_nfe/helper/have_destinatario_test'
4
- require 'br_nfe/helper/have_intermediario_test'
5
- require 'br_nfe/helper/have_condicao_pagamento_test'
6
-
7
- describe BrNfe::Response::Service::NotaFiscal do
8
- subject { FactoryGirl.build(:response_service_nota_fiscal, emitente: emitente) }
9
- let(:emitente) { FactoryGirl.build(:emitente) }
10
- let(:destinatario) { subject.destinatario }
11
- let(:intermediario) { subject.intermediario }
12
- let(:condicao_pagamento) { subject.condicao_pagamento }
13
-
14
- describe "#emitente" do
15
- include BrNfeTest::HelperTest::HaveEmitenteTest
16
- end
17
-
18
- describe "#destinatario" do
19
- include BrNfeTest::HelperTest::HaveDestinatarioTest
20
- end
21
-
22
- describe "#intermediario" do
23
- include BrNfeTest::HelperTest::HaveIntermediarioTest
24
- end
25
-
26
- describe "#condicao_pagamento" do
27
- include BrNfeTest::HelperTest::HaveCondicaoPagamentoTest
28
- end
29
-
30
- describe "#substituida?" do
31
- it "quando tem valor em nfe_substituidora" do
32
- subject.nfe_substituidora = '666'
33
- subject.substituida?.must_equal true
34
- end
35
-
36
- it "quando não tem valor na nfe_substituidora" do
37
- subject.nfe_substituidora = ''
38
- subject.substituida?.must_equal false
39
- end
40
- end
41
- end
@@ -1,196 +0,0 @@
1
- require 'test_helper'
2
-
3
- class ResponsePathsBaseTest
4
- include BrNfe::Service::Response::Paths::Base
5
- end
6
-
7
- describe BrNfe::Service::Response::Paths::Base do
8
- subject { ResponsePathsBaseTest.new }
9
-
10
- it 'valor padrão para o método lot_number_path' do
11
- subject.response_lot_number_path.must_equal []
12
- end
13
- it 'valor padrão para o método protocol_path' do
14
- subject.response_protocol_path.must_equal []
15
- end
16
- it 'valor padrão para o método received_date_path' do
17
- subject.response_received_date_path.must_equal []
18
- end
19
- it 'valor padrão para o método situation_path' do
20
- subject.response_situation_path.must_equal []
21
- end
22
- it 'valor padrão para o método cancelation_date_time_path' do
23
- subject.response_cancelation_date_time_path.must_equal []
24
- end
25
- it 'valor padrão para o método message_errors_path' do
26
- subject.response_message_errors_path.must_equal []
27
- end
28
- it 'valor padrão para o método message_code_key' do
29
- subject.response_message_code_key.must_equal :codigo
30
- end
31
- it 'valor padrão para o método message_msg_key' do
32
- subject.response_message_msg_key.must_equal :mensagem
33
- end
34
- it 'valor padrão para o método message_solution_key' do
35
- subject.response_message_solution_key.must_equal :correcao
36
- end
37
- it 'valor padrão para o método invoices_path' do
38
- subject.response_invoices_path.must_equal []
39
- end
40
- it 'valor padrão para o método invoice_numero_nf_path' do
41
- subject.response_invoice_numero_nf_path.must_equal []
42
- end
43
- it 'valor padrão para o método invoice_codigo_verificacao_path' do
44
- subject.response_invoice_codigo_verificacao_path.must_equal []
45
- end
46
- it 'valor padrão para o método invoice_data_emissao_path' do
47
- subject.response_invoice_data_emissao_path.must_equal []
48
- end
49
- it 'valor padrão para o método invoice_url_nf_path' do
50
- subject.response_invoice_url_nf_path.must_equal []
51
- end
52
- it 'valor padrão para o método invoice_rps_numero_path' do
53
- subject.response_invoice_rps_numero_path.must_equal []
54
- end
55
- it 'valor padrão para o método invoice_rps_serie_path' do
56
- subject.response_invoice_rps_serie_path.must_equal []
57
- end
58
- it 'valor padrão para o método invoice_rps_tipo_path' do
59
- subject.response_invoice_rps_tipo_path.must_equal []
60
- end
61
- it 'valor padrão para o método invoice_rps_situacao_path' do
62
- subject.response_invoice_rps_situacao_path.must_equal []
63
- end
64
- it 'valor padrão para o método invoice_rps_substituido_numero_path' do
65
- subject.response_invoice_rps_substituido_numero_path.must_equal []
66
- end
67
- it 'valor padrão para o método invoice_rps_substituido_serie_path' do
68
- subject.response_invoice_rps_substituido_serie_path.must_equal []
69
- end
70
- it 'valor padrão para o método invoice_rps_substituido_tipo_path' do
71
- subject.response_invoice_rps_substituido_tipo_path.must_equal []
72
- end
73
- it 'valor padrão para o método invoice_data_emissao_rps_path' do
74
- subject.response_invoice_data_emissao_rps_path.must_equal []
75
- end
76
- it 'valor padrão para o método invoice_competencia_path' do
77
- subject.response_invoice_competencia_path.must_equal []
78
- end
79
- it 'valor padrão para o método invoice_outras_informacoes_path' do
80
- subject.response_invoice_outras_informacoes_path.must_equal []
81
- end
82
- it 'valor padrão para o método invoice_item_lista_servico_path' do
83
- subject.response_invoice_item_lista_servico_path.must_equal []
84
- end
85
- it 'valor padrão para o método invoice_cnae_code_path' do
86
- subject.response_invoice_cnae_code_path.must_equal []
87
- end
88
- it 'valor padrão para o método invoice_description_path' do
89
- subject.response_invoice_description_path.must_equal []
90
- end
91
- it 'valor padrão para o método invoice_codigo_municipio_path' do
92
- subject.response_invoice_codigo_municipio_path.must_equal []
93
- end
94
- it 'valor padrão para o método invoice_total_services_path' do
95
- subject.response_invoice_total_services_path.must_equal []
96
- end
97
- it 'valor padrão para o método invoice_deductions_path' do
98
- subject.response_invoice_deductions_path.must_equal []
99
- end
100
- it 'valor padrão para o método invoice_valor_pis_path' do
101
- subject.response_invoice_valor_pis_path.must_equal []
102
- end
103
- it 'valor padrão para o método invoice_valor_cofins_path' do
104
- subject.response_invoice_valor_cofins_path.must_equal []
105
- end
106
- it 'valor padrão para o método invoice_valor_inss_path' do
107
- subject.response_invoice_valor_inss_path.must_equal []
108
- end
109
- it 'valor padrão para o método invoice_valor_ir_path' do
110
- subject.response_invoice_valor_ir_path.must_equal []
111
- end
112
- it 'valor padrão para o método invoice_valor_csll_path' do
113
- subject.response_invoice_valor_csll_path.must_equal []
114
- end
115
- it 'valor padrão para o método invoice_iss_retained_path' do
116
- subject.response_invoice_iss_retained_path.must_equal []
117
- end
118
- it 'valor padrão para o método invoice_outras_retencoes_path' do
119
- subject.response_invoice_outras_retencoes_path.must_equal []
120
- end
121
- it 'valor padrão para o método invoice_total_iss_path' do
122
- subject.response_invoice_total_iss_path.must_equal []
123
- end
124
- it 'valor padrão para o método invoice_base_calculation_path' do
125
- subject.response_invoice_base_calculation_path.must_equal []
126
- end
127
- it 'valor padrão para o método invoice_iss_tax_rate_path' do
128
- subject.response_invoice_iss_tax_rate_path.must_equal []
129
- end
130
- it 'valor padrão para o método invoice_valor_liquido_path' do
131
- subject.response_invoice_valor_liquido_path.must_equal []
132
- end
133
- it 'valor padrão para o método invoice_desconto_condicionado_path' do
134
- subject.response_invoice_desconto_condicionado_path.must_equal []
135
- end
136
- it 'valor padrão para o método invoice_desconto_incondicionado_path' do
137
- subject.response_invoice_desconto_incondicionado_path.must_equal []
138
- end
139
- it 'valor padrão para o método invoice_responsavel_retencao_path' do
140
- subject.response_invoice_responsavel_retencao_path.must_equal []
141
- end
142
- it 'valor padrão para o método invoice_numero_processo_path' do
143
- subject.response_invoice_numero_processo_path.must_equal []
144
- end
145
- it 'valor padrão para o método invoice_municipio_incidencia_path' do
146
- subject.response_invoice_municipio_incidencia_path.must_equal []
147
- end
148
- it 'valor padrão para o método invoice_orgao_gerador_municipio_path' do
149
- subject.response_invoice_orgao_gerador_municipio_path.must_equal []
150
- end
151
- it 'valor padrão para o método invoice_orgao_gerador_uf_path' do
152
- subject.response_invoice_orgao_gerador_uf_path.must_equal []
153
- end
154
- it 'valor padrão para o método invoice_cancelamento_codigo_path' do
155
- subject.response_invoice_cancelamento_codigo_path.must_equal []
156
- end
157
- it 'valor padrão para o método invoice_cancelamento_numero_nf_path' do
158
- subject.response_invoice_cancelamento_numero_nf_path.must_equal []
159
- end
160
- it 'valor padrão para o método invoice_cancelamento_cnpj_path' do
161
- subject.response_invoice_cancelamento_cnpj_path.must_equal []
162
- end
163
- it 'valor padrão para o método invoice_cancelamento_municipio_path' do
164
- subject.response_invoice_cancelamento_municipio_path.must_equal []
165
- end
166
- it 'valor padrão para o método invoice_cancelamento_data_hora_path' do
167
- subject.response_invoice_cancelamento_data_hora_path.must_equal []
168
- end
169
- it 'valor padrão para o método invoice_nfe_substituidora_path' do
170
- subject.response_invoice_nfe_substituidora_path.must_equal []
171
- end
172
- it 'valor padrão para o método invoice_codigo_obra_path' do
173
- subject.response_invoice_codigo_obra_path.must_equal []
174
- end
175
- it 'valor padrão para o método invoice_codigo_art_path' do
176
- subject.response_invoice_codigo_art_path.must_equal []
177
- end
178
- it 'valor padrão para o método invoice_cancelamento_inscricao_municipal_path' do
179
- subject.response_invoice_cancelamento_inscricao_municipal_path.must_equal []
180
- end
181
-
182
- describe "#situation_key_values" do
183
- it "Chave para não recebido deve ser '1' " do
184
- subject.response_situation_key_values['1'].must_equal :unreceived
185
- end
186
- it "Chave para não processado deve ser '2' " do
187
- subject.response_situation_key_values['2'].must_equal :unprocessed
188
- end
189
- it "Chave para erro no processamento deve ser '3' " do
190
- subject.response_situation_key_values['3'].must_equal :error
191
- end
192
- it "Chave para processado com sucesso deve ser '4' " do
193
- subject.response_situation_key_values['4'].must_equal :success
194
- end
195
- end
196
- end
@@ -1,25 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoCancelarNfseResposta do
4
-
5
- class ResponsePathsV1ServicoCancelarNfseRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoCancelarNfseResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoCancelarNfseRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- describe "métodos sobrescritos do module ..Base" do
16
- it 'valor do método message_errors_path' do
17
- subject.response_message_errors_path.must_equal [:cancelar_nfse_resposta, :lista_mensagem_retorno, :mensagem_retorno]
18
- end
19
-
20
- it 'valor do método cancelation_date_time_path' do
21
- subject.response_cancelation_date_time_path.must_equal [:cancelar_nfse_resposta, :cancelamento, :confirmacao, :inf_confirmacao_cancelamento, :data_hora]
22
- end
23
- end
24
-
25
- end
@@ -1,30 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoConsultarLoteRpsResposta do
4
-
5
- class ResponsePathsV1ServicoConsultarLoteRpsRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoConsultarLoteRpsResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoConsultarLoteRpsRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- it "deve estar incluso o module BrNfe::Service::Response::Paths::V1::TcNfse" do
16
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::V1::TcNfse
17
- end
18
-
19
- describe "métodos sobrescritos do module ..Base" do
20
- it 'valor do método message_errors_path' do
21
- subject.response_message_errors_path.must_equal [:consultar_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
22
- end
23
-
24
- it 'valor do método invoices_path' do
25
- subject.response_invoices_path.must_equal [:consultar_lote_rps_resposta, :lista_nfse, :comp_nfse]
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,30 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoConsultarNfseResposta do
4
-
5
- class ResponsePathsV1ServicoConsultarNfseRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoConsultarNfseResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoConsultarNfseRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- it "deve estar incluso o module BrNfe::Service::Response::Paths::V1::TcNfse" do
16
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::V1::TcNfse
17
- end
18
-
19
- describe "métodos sobrescritos do module ..Base" do
20
- it 'valor do método message_errors_path' do
21
- subject.response_message_errors_path.must_equal [:consultar_nfse_resposta, :lista_mensagem_retorno, :mensagem_retorno]
22
- end
23
-
24
- it 'valor do método invoices_path' do
25
- subject.response_invoices_path.must_equal [:consultar_nfse_resposta, :lista_nfse, :comp_nfse]
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,30 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoConsultarNfseRpsResposta do
4
-
5
- class ResponsePathsV1ServicoConsultarNfseRpsRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoConsultarNfseRpsResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoConsultarNfseRpsRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- it "deve estar incluso o module BrNfe::Service::Response::Paths::V1::TcNfse" do
16
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::V1::TcNfse
17
- end
18
-
19
- describe "métodos sobrescritos do module ..Base" do
20
- it 'valor do método message_errors_path' do
21
- subject.response_message_errors_path.must_equal [:consultar_nfse_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
22
- end
23
-
24
- it 'valor do método invoices_path' do
25
- subject.response_invoices_path.must_equal [:consultar_nfse_rps_resposta, :comp_nfse]
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,30 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoConsultarSituacaoLoteRpsResposta do
4
-
5
- class ResponsePathsV1ServicoConsultarSituacaoLoteRpsRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoConsultarSituacaoLoteRpsResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoConsultarSituacaoLoteRpsRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- describe "métodos sobrescritos do module ..Base" do
16
- it 'valor do método lot_number_path' do
17
- subject.response_lot_number_path.must_equal [:consultar_situacao_lote_rps_resposta, :numero_lote]
18
- end
19
-
20
- it 'valor do método situation_path' do
21
- subject.response_situation_path.must_equal [:consultar_situacao_lote_rps_resposta, :situacao]
22
- end
23
-
24
- it 'valor do método message_errors_path' do
25
- subject.response_message_errors_path.must_equal [:consultar_situacao_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno]
26
- end
27
-
28
- end
29
-
30
- end
@@ -1,34 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Response::Paths::V1::ServicoEnviarLoteRpsResposta do
4
-
5
- class ResponsePathsV1ServicoEnviarLoteRpsRespostaTest
6
- include BrNfe::Service::Response::Paths::V1::ServicoEnviarLoteRpsResposta
7
- end
8
-
9
- subject { ResponsePathsV1ServicoEnviarLoteRpsRespostaTest.new }
10
-
11
- it "deve estar incluso o module BrNfe::Service::Response::Paths::Base" do
12
- subject.class.included_modules.must_include BrNfe::Service::Response::Paths::Base
13
- end
14
-
15
- describe "métodos sobrescritos do module ..Base" do
16
- it 'valor do método lot_number_path' do
17
- subject.response_lot_number_path.must_equal([:enviar_lote_rps_resposta, :numero_lote] )
18
- end
19
-
20
- it 'valor do método protocol_path' do
21
- subject.response_protocol_path.must_equal([:enviar_lote_rps_resposta, :protocolo] )
22
- end
23
-
24
- it 'valor do método received_date_path' do
25
- subject.response_received_date_path.must_equal([:enviar_lote_rps_resposta, :data_recebimento] )
26
- end
27
-
28
- it 'valor do método message_errors_path' do
29
- subject.response_message_errors_path.must_equal([:enviar_lote_rps_resposta, :lista_mensagem_retorno, :mensagem_retorno])
30
- end
31
-
32
- end
33
-
34
- end
@@ -1,54 +0,0 @@
1
- require 'test_helper'
2
-
3
- describe BrNfe::Service::Betha::V1::CancelamentoNfs do
4
- subject { FactoryGirl.build(:servico_betha_cancelamento_nfs, emitente: emitente) }
5
- let(:emitente) { FactoryGirl.build(:emitente) }
6
-
7
- describe "superclass" do
8
- it { subject.class.superclass.must_equal BrNfe::Service::Betha::V1::Gateway }
9
- end
10
-
11
- it "deve conter as regras de BrNfe::Service::Concerns::Rules::CancelamentoNfs inclusas" do
12
- subject.class.included_modules.must_include BrNfe::Service::Concerns::Rules::CancelamentoNfs
13
- end
14
-
15
- it "o certificado deve ser obrigatório" do
16
- subject.certificado_obrigatorio?.must_equal true
17
- end
18
-
19
- describe "#wsdl" do
20
- context "for env production" do
21
- it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-ws/cancelarNfseV02?wsdl' }
22
- end
23
- context "for env test" do
24
- before do
25
- subject.env = :test
26
- end
27
- it { subject.wsdl.must_equal 'http://e-gov.betha.com.br/e-nota-contribuinte-test-ws/cancelarNfseV02?wsdl' }
28
- end
29
- end
30
-
31
- describe "#method_wsdl" do
32
- it { subject.method_wsdl.must_equal :cancelar_nfse_envio }
33
- end
34
-
35
- it "#response_root_path" do
36
- subject.response_root_path.must_equal [:cancelar_nfse_envio_response]
37
- end
38
-
39
- describe "Validação do XML através do XSD" do
40
- let(:schemas_dir) { BrNfe.root+'/test/br_nfe/service/betha/v1/xsd' }
41
-
42
- describe "Validações a partir do arquivo XSD" do
43
- it "Deve ser válido com 1 RPS com todas as informações preenchidas" do
44
- Dir.chdir(schemas_dir) do
45
- schema = Nokogiri::XML::Schema(IO.read('servico_cancelar_nfse_envio_v01.xsd'))
46
- document = Nokogiri::XML(subject.content_xml)
47
- errors = schema.validate(document)
48
- errors.must_be_empty
49
- end
50
- end
51
- end
52
- end
53
-
54
- end