Produced by Araxis Merge on 11/16/2017 4:02:46 PM Eastern Standard Time. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.
| # | Location | File | Last Modified |
|---|---|---|---|
| 1 | CUI-CPP-v2.3.1-release.zip\spec\jobs | vler_das_job_spec.rb | Fri Oct 20 20:13:45 2017 UTC |
| 2 | CUI-CPP-v2.3.1-release.zip\spec\jobs | vler_das_job_spec.rb | Tue Nov 14 16:27:16 2017 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 230 |
| Changed | 1 | 2 |
| Inserted | 0 | 0 |
| Removed | 0 | 0 |
| Whitespace | |
|---|---|
| Character case | Differences in character case are significant |
| Line endings | Differences in line endings (CR and LF characters) are ignored |
| CR/LF characters | Not shown in the comparison detail |
No regular expressions were active.
| 1 | require 'r ails_helpe r' | |
| 2 | require 'm ail' | |
| 3 | HTTPI.log = false | |
| 4 | ||
| 5 | RSpec.desc ribe VlerD ASJob, :ty pe => :job do | |
| 6 | before d o | |
| 7 | allow_ any_instan ce_of(Eval uation).to receive(: signed?).a nd_return( true) | |
| 8 | @evalu ation_spec = create( :tmj_spec) | |
| 9 | @claim = create( :claim) | |
| 10 | @user = create(: examiner) | |
| 11 | @claim .contentio ns << crea te(:conten tion, hist ory: "This or That") | |
| 12 | @evalu ation = Ev aluation.n ew(claim: @claim, | |
| 13 | evaluat ion_spec: @evaluatio n_spec, | |
| 14 | doc: bu ild(:tmj_e val).doc, | |
| 15 | complet ed_at: Tim e.now, | |
| 16 | user: @ user) | |
| 17 | @claim .contentio ns.first.e valuations << @evalu ation | |
| 18 | @evalu ation.comp lete! @use r | |
| 19 | allow_ any_instan ce_of(Eval uation).to receive(: to_pdf) { "" } | |
| 20 | ENV['V LER_DAS_UR L'] = "htt p://exampl e.com/api/ v1" | |
| 21 | WebMoc k.enable! | |
| 22 | end | |
| 23 | ||
| 24 | after do | |
| 25 | WebMoc k.disable! | |
| 26 | end | |
| 27 | ||
| 28 | it "does not creat e a reques t to send if the eva luation is not compl ete and lo gs the err or" do | |
| 29 | evalua tion_spec = create(: diabetes_s pec) | |
| 30 | claim = create(: claim) | |
| 31 | user = cre ate(:user, email: " PII ") | |
| 32 | claim. contention s << creat e(:content ion, histo ry: "This or That") | |
| 33 | evalua tion = Eva luation.ne w(claim: c laim, | |
| 34 | evaluati on_spec: e valuation_ spec, | |
| 35 | doc: bui ld(:diabet es_doc).do c, | |
| 36 | user: us er) | |
| 37 | claim. contention s.first.ev aluations << evaluat ion | |
| 38 | ENV['V LER_DAS_UR L'] = "htt p://exampl e.com/api/ v1" | |
| 39 | WebMoc k.enable! | |
| 40 | expect (subject). to_not rec eive(:buil d_request) | |
| 41 | expect {subject.p erform(eva luation)}. to change{ Evaluation Log.count} .by(1) | |
| 42 | end | |
| 43 | ||
| 44 | it "does not send data to vl erdas when evaluatio n xml is i nvalid, an d logs the failure" do | |
| 45 | allow( @evaluatio n).to rece ive(:to_xm l) { "meow s" } | |
| 46 | expect (subject). to_not rec eive(:buil d_request) | |
| 47 | expect {subject.p erform(@ev aluation)} .to change {Evaluatio nLog.count }.by(1) | |
| 48 | end | |
| 49 | ||
| 50 | it "send s data to vlerdas" d o | |
| 51 | stub_r equest(:po st, ENV['V LER_DAS_UR L']).with {|request| | |
| 52 | head ers = requ est.header s.map {|k, v| "#{k}: #{v}"}.joi n("\r\n") | |
| 53 | msgb ody = "#{h eaders}\r\ n\r\n#{req uest.body} " | |
| 54 | ||
| 55 | # To test that it's a va lid multip art mime m essage, us e the mail module | |
| 56 | mail = Mail.ne w(msgbody) | |
| 57 | expe ct(mail.mu ltipart?) | |
| 58 | expe ct(mail.co ntent_type ).to match "multipar t/form-dat a" | |
| 59 | expe ct(mail.he ader["Acce pt"].value ).to match "applicat ion/json" | |
| 60 | expe ct(mail.pa rts.length ).to eq 1 | |
| 61 | ||
| 62 | mp = mail.part s[0] | |
| 63 | expe ct(mp.cont ent_type). to match " applicatio n/xml" | |
| 64 | expe ct(mp.cont ent_dispos ition).to match "fil ename=cui- #{@evaluat ion.guid}. xml" | |
| 65 | expe ct(mp.cont ent_dispos ition).to match "nam e=file" | |
| 66 | ||
| 67 | expe ct(request .uri.host) .to eq "ex ample.com" | |
| 68 | expe ct(request .uri.path) .to eq "/a pi/v1" | |
| 69 | expe ct(request .body).to match '^-- 3e776445' | |
| 70 | } | |
| 71 | subjec t.perform( @evaluatio n) | |
| 72 | end | |
| 73 | ||
| 74 | it "logs to the ev aluation l og table" do | |
| 75 | stub_r equest(:po st, ENV['V LER_DAS_UR L']).with {|request| | |
| 76 | head ers = requ est.header s.map {|k, v| "#{k}: #{v}"}.joi n("\r\n") | |
| 77 | msgb ody = "#{h eaders}\r\ n\r\n#{req uest.body} " | |
| 78 | } | |
| 79 | expect {subject.p erform(@ev aluation)} .to change {Evaluatio nLog.count }.by(1) | |
| 80 | end | |
| 81 | ||
| 82 | context "SSL Envir onment Var iables" do | |
| 83 | it "do esn't use :peer if n o keyfile is present " do | |
| 84 | ENV. delete("VL ER_DAS_KEY FILE") | |
| 85 | ||
| 86 | allo w(@evaluat ion).to re ceive(:ren der_html). and_return "<html>si mple</html >" | |
| 87 | allo w(@evaluat ion).to re ceive(:to_ xml).and_r eturn "<xm l>simple</ xml>" | |
| 88 | ||
| 89 | expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to receive(:v erify_mode =).with(:n one) | |
| 90 | ||
| 91 | stub _request(: post, ENV[ 'VLER_DAS_ URL']) | |
| 92 | allo w(@evaluat ion).to re ceive(:val idate_xml) .and_retur n([]) | |
| 93 | subj ect.perfor m(@evaluat ion) | |
| 94 | end | |
| 95 | ||
| 96 | it "us es a keyfi le only if keyfile i s present" do | |
| 97 | ENV[ 'VLER_DAS_ URL'] = "h ttps://exa mple.com/a pi/v1" | |
| 98 | ENV[ "VLER_DAS_ KEYFILE"] = "/tmp/ke y.crt" | |
| 99 | ENV[ "VLER_DAS_ KEYPASS"] = "passwor d" | |
| 100 | ENV[ "VLER_DAS_ CERT"] = " /a/cert/fi le" | |
| 101 | ENV[ "VLER_DAS_ CACERT"] = "/a/ca/ce rt" | |
| 102 | ||
| 103 | allo w(@evaluat ion).to re ceive(:ren der_html). and_return "<html>si mple</html >" | |
| 104 | allo w(@evaluat ion).to re ceive(:to_ xml).and_r eturn "<xm l>simple</ xml>" | |
| 105 | ||
| 106 | expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to receive(:c ert_key_fi le=).with( ENV["VLER_ DAS_KEYFIL E"]) { ENV ["VLER_DAS _KEYFILE"] } | |
| 107 | expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to receive(:c ert_key_pa ssword=).w ith(ENV["V LER_DAS_KE YPASS"]) { ENV["VLER _DAS_KEYPA SS"] } | |
| 108 | expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to receive(:c ert_file=) .with(ENV[ "VLER_DAS_ CERT"]) { ENV["VLER_ DAS_CERT"] } | |
| 109 | expe ct_any_ins tance_of(H TTPI::Auth ::SSL).to receive(:c a_cert_fil e=).with(E NV["VLER_D AS_CACERT" ]) { ENV[" VLER_DAS_C ACERT"] } | |
| 110 | ||
| 111 | stub _request(: post, ENV[ 'VLER_DAS_ URL']) | |
| 112 | allo w(@evaluat ion).to re ceive(:val idate_xml) .and_retur n([]) | |
| 113 | subj ect.perfor m(@evaluat ion) | |
| 114 | end | |
| 115 | end | |
| 116 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.