Produced by Araxis Merge on 2/21/2018 6:58:15 AM Central 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.4.0-source-archive.zip\spec\requests\api\v1 | claims_spec.rb | Thu Dec 21 03:33:17 2017 UTC |
| 2 | CUI-CPP-v2.4.0-source-archive.zip\spec\requests\api\v1 | claims_spec.rb | Tue Feb 6 20:21:16 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 3 | 168 |
| Changed | 2 | 4 |
| 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 | ||
| 3 | RSpec.desc ribe "api/ v1/claims" , :type => :request do | |
| 4 | before d o | |
| 5 | create (:hearing_ loss_evalu ation_spec ) | |
| 6 | create (:elbow_an d_forearm_ evaluation _spec) | |
| 7 | end | |
| 8 | ||
| 9 | let(:exa mple_reque st_sample) { File.op en('spec/s upport/exa m_request_ sample.xml ', 'rb').r ead } | |
| 10 | ||
| 11 | ||
| 12 | context "when the exam is as signed to a user tha t is not c urrently i n the syst em" do | |
| 13 | it "sh ould creat e that use r and assi gn the exa m to them" do | |
| 14 | expe ct { post api_v1_cla ims_path, example_re quest_samp le, {'CONT ENT_TYPE' => 'applic ation/xml' } }.to cha nge(User, :count).by (1) | |
| 15 | end | |
| 16 | end | |
| 17 | ||
| 18 | context "when the exam is as signed to an existin g user" do | |
| 19 | before do | |
| 20 | user = cre ate(:user, first_nam e: "Mae", last_name: "Jemison" , email: " PII ") | |
| 21 | end | |
| 22 | ||
| 23 | contex t "with xm l that has a valid c laim, cont ention and evaluatio ns" do | |
| 24 | it " returns a created re sponse sta tus code" do | |
| 25 | po st api_v1_ claims_pat h, example _request_s ample, {'C ONTENT_TYP E' => 'app lication/x ml'} | |
| 26 | ex pect(respo nse).to ha ve_http_st atus(:crea ted) | |
| 27 | end | |
| 28 | ||
| 29 | it " stores a h ash of the exam_requ est data w ith the cl aim" do | |
| 30 | po st api_v1_ claims_pat h, example _request_s ample, {'C ONTENT_TYP E' => 'app lication/x ml'} | |
| 31 | ex pect(Claim .last.exam _request_d ata['Claim Informatio n']['Claim Id']).to e q ('123xyz ') | |
| 32 | end | |
| 33 | ||
| 34 | it " creates a claim for an existin g user" do | |
| 35 | ex pect { pos t api_v1_c laims_path , example_ request_sa mple, | |
| 36 | {'CON TENT_TYPE' => 'appli cation/xml '} }.to ch ange(Claim , :count). by(1) | |
| 37 | end | |
| 38 | ||
| 39 | it " creates a contention for an ex isting use r" do | |
| 40 | ex pect { pos t api_v1_c laims_path , example_ request_sa mple, | |
| 41 | {'CON TENT_TYPE' => 'appli cation/xml '} }.to ch ange(Conte ntion, :co unt).by(1) | |
| 42 | end | |
| 43 | ||
| 44 | it " does not c reate a ne w user" do | |
| 45 | ex pect { pos t api_v1_c laims_path , example_ request_sa mple, | |
| 46 | {'CON TENT_TYPE' => 'appli cation/xml '} }.not_t o change(U ser, :coun t) | |
| 47 | end | |
| 48 | ||
| 49 | it " should log the ExamR equest" do | |
| 50 | ex pect { pos t api_v1_c laims_path , example_ request_sa mple, {'CO NTENT_TYPE ' => 'appl ication/xm l'} }.to c hange(Exam Request, : count) | |
| 51 | end | |
| 52 | ||
| 53 | cont ext "when there are three eval uations de fined in t he xml, bu t only two have CUI evaluation specs" do | |
| 54 | it "creates two evalua tions" do | |
| 55 | expect { p ost api_v1 _claims_pa th, exampl e_request_ sample, | |
| 56 | {'C ONTENT_TYP E' => 'app lication/x ml'} }.to change(Eva luation, : count).by( 2) | |
| 57 | en d | |
| 58 | ||
| 59 | it "creates four log e ntries" do | |
| 60 | # Two for evaluation s created, two for E xamRequest s | |
| 61 | expect { p ost api_v1 _claims_pa th, exampl e_request_ sample, | |
| 62 | {'C ONTENT_TYP E' => 'app lication/x ml'} }.to change(Eva luationLog , :count). by(4) | |
| 63 | en d | |
| 64 | end | |
| 65 | end | |
| 66 | end | |
| 67 | ||
| 68 | context "with inva lid xml" d o | |
| 69 | let(:inval id_xml) { '<?xml ver sion="1.0" encoding= "UTF-8" ?> <feed xmln s="http:// www.w3.org /2005/Atom " xsi:sche maLocation ="http://w ww.w3.org/ 2005/Atom http://vle r. DNS /vler/sche mas/atom/2 005/vler/0 .2/atom.xs d" xmlns:x si="http:/ /www.w3.or g/2001/XML Schema-ins tance"> | |
| 70 | </feed>' } | |
| 71 | ||
| 72 | it "re turns an u nprocessab le entity response s tatus code " do | |
| 73 | post api_v1_cl aims_path, invalid_x ml, {'CONT ENT_TYPE' => 'applic ation/xml' } | |
| 74 | expe ct(respons e).to have _http_stat us(:unproc essable_en tity) | |
| 75 | end | |
| 76 | ||
| 77 | it "do es not cre ate a clai m" do | |
| 78 | expe ct { post api_v1_cla ims_path, invalid_xm l, {'CONTE NT_TYPE' = > 'applica tion/xml'} } | |
| 79 | .to_not change(Cl aim, :coun t) | |
| 80 | end | |
| 81 | ||
| 82 | it "sh ould log a n error" d o | |
| 83 | expe ct { post api_v1_cla ims_path, invalid_xm l, {'CONTE NT_TYPE' = > 'applica tion/xml'} }.to chan ge(ExamReq uest, :cou nt) | |
| 84 | end | |
| 85 | end | |
| 86 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.