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 | contentions_spec.rb | Thu Dec 21 03:33:17 2017 UTC |
| 2 | CUI-CPP-v2.4.0-source-archive.zip\spec\requests | contentions_spec.rb | Tue Feb 6 20:21:11 2018 UTC |
| Description | Between Files 1 and 2 |
|
|---|---|---|
| Text Blocks | Lines | |
| Unchanged | 2 | 1438 |
| 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 | #!/bin/env ruby | |
| 2 | # encoding : utf-8 | |
| 3 | require 'r ails_helpe r' | |
| 4 | ||
| 5 | RSpec.desc ribe "Cont entions", type: :req uest do | |
| 6 | before d o | |
| 7 | @user = create(: examiner) | |
| 8 | @user_2 = create(:us er, first_ name: "Ms" , last_nam e: "Green" , email: " doctor2@ DNS ") | |
| 9 | login_ as @user | |
| 10 | @evalu ation_spec = create( :evaluatio n_spec) | |
| 11 | allow_ any_instan ce_of(Eval uation).to receive(: signed?).a nd_return( true) | |
| 12 | @spec_ 1 = create (:short_sp ec01) | |
| 13 | @spec_ 2 = create (:short_sp ec02) | |
| 14 | @spec_ 3 = create (:short_sp ec03) | |
| 15 | end | |
| 16 | ||
| 17 | describe "GET /cla ims/:claim _id/conten tions/new" do | |
| 18 | before do | |
| 19 | @cla im = creat e :claim | |
| 20 | @cla im.content ions << cr eate(:cont ention) | |
| 21 | end | |
| 22 | ||
| 23 | contex t "when th e user is not a medi cal assist ant" do | |
| 24 | it " should not show the user a lin k to creat e a new co ntention o r let them visit the new conte ntion page " do | |
| 25 | vi sit claim_ path(@clai m) | |
| 26 | ex pect(page) .to have_n o_link 'Cr eate new c ontention' , href: ne w_claim_co ntention_p ath(@claim ) | |
| 27 | vi sit new_cl aim_conten tion_path( @claim) | |
| 28 | ex pect(page) .to have_c ontent "Yo u are not authorized to access this page ." | |
| 29 | end | |
| 30 | end | |
| 31 | ||
| 32 | contex t "when th e user is a medical assistant" do | |
| 33 | befo re do | |
| 34 | @u ser.roles = ["medica l_assistan t"] | |
| 35 | end | |
| 36 | ||
| 37 | it " should cre ate the co ntention a nd allow t he user to view it" do | |
| 38 | vi sit claim_ path(@clai m) | |
| 39 | cl ick_link ' Create new contentio n' | |
| 40 | fi ll_in "Nam e", with: "Ouchie" | |
| 41 | cl ick_button 'Create c ontention' | |
| 42 | ex pect(page) .to have_c ontent 'Co ntention c reated' | |
| 43 | ex pect(page) .to have_l ink 'Ouchi e', href: claim_cont ention_pat h(@claim, @claim.con tentions.l ast) | |
| 44 | end | |
| 45 | ||
| 46 | it " when no na me is prov ided it sh ows an err or message " do | |
| 47 | vi sit new_cl aim_conten tion_path( @claim) | |
| 48 | cl ick_button 'Create c ontention' | |
| 49 | ex pect(page) .to have_c ontent "Na me can't b e blank" | |
| 50 | end | |
| 51 | ||
| 52 | cont ext "when the claim has one or more eval uations" d o | |
| 53 | be fore do | |
| 54 | @user2 = c reate("exa miner") | |
| 55 | en d | |
| 56 | ||
| 57 | i t "should allow an o wner medic al assista nt to dele te the eva luation" d o | |
| 58 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @evaluat ion_spec, claim: @cl aim, user: @user) | |
| 59 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 60 | expect(pag e).to have _link 'Del ete', href : "/claims /#{@claim. id}/evalua tions/#{@c laim.conte ntions.fir st.evaluat ions.first .id}" | |
| 61 | click_link 'Delete' | |
| 62 | expect(pag e).to have _content " Successful ly deleted evaluatio n" | |
| 63 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 64 | expect(pag e).to have _no_link ' Delete' | |
| 65 | e nd | |
| 66 | ||
| 67 | i t "should allow a no n-owner me dical assi stant to d elete the evaluation " do | |
| 68 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @evaluat ion_spec, claim: @cl aim, user: @user2) | |
| 69 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 70 | expect(pag e).to have _link 'Del ete', href : "/claims /#{@claim. id}/evalua tions/#{@c laim.conte ntions.fir st.evaluat ions.first .id}" | |
| 71 | click_link 'Delete' | |
| 72 | expect(pag e).to have _content " Successful ly deleted evaluatio n" | |
| 73 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 74 | expect(pag e).to have _no_link ' Delete' | |
| 75 | e nd | |
| 76 | end | |
| 77 | end | |
| 78 | end | |
| 79 | ||
| 80 | describe "GET /cla ims/:claim _id/conten tions/:id" do | |
| 81 | contex t "when a claim is u nresolved and has re solved and unresolve d contenti ons" do | |
| 82 | befo re do | |
| 83 | @c laim = cre ate :claim | |
| 84 | @c laim.conte ntions << create(:co ntention) | |
| 85 | end | |
| 86 | ||
| 87 | cont ext "when a user mak es a chang e" do | |
| 88 | be fore do | |
| 89 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 90 | en d | |
| 91 | ||
| 92 | xi t "changes the evalu ation last update ti me", js: t rue do | |
| 93 | last_updat e = find(" #contentio n-updated" ).text | |
| 94 | fill_in "D escribe th e history of the Vet eran’s con dition", w ith: "Hist ory goes h ere" | |
| 95 | choose 'co ntention_c laim_folde r_reviewed _false' | |
| 96 | sleep 62 | |
| 97 | expect(fin d("#conten tion-updat ed")).to_n ot have_co ntent last _update | |
| 98 | en d | |
| 99 | end | |
| 100 | ||
| 101 | cont ext "when the conten tion has a t least on e evaluati on" do | |
| 102 | be fore do | |
| 103 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @evaluat ion_spec, claim: @cl aim, user: @user) | |
| 104 | en d | |
| 105 | ||
| 106 | co ntext "whe n viewing the unreso lved conte ntion" do | |
| 107 | before do | |
| 108 | visit cl aim_conten tion_path( @claim, @c laim.conte ntions.fir st) | |
| 109 | end | |
| 110 | ||
| 111 | it "should show the name and c ontention informatio n, and lin k to the e valuation spec" do | |
| 112 | expect(p age).to ha ve_content "Claim: # {@claim.pa tient_name } #{@claim .created_a t.to_date} " | |
| 113 | expect(p age).to ha ve_content "Contenti on: #{@cla im.content ions.first .name}" | |
| 114 | expect(p age).to ha ve_no_cont ent "Conte ntion comp lete" | |
| 115 | expect(p age).to ha ve_no_cont ent "Send to adminis trator for review" | |
| 116 | expect(p age).to ha ve_no_cont ent("View a differen t contenti on for thi s claim") | |
| 117 | end | |
| 118 | ||
| 119 | context "w hen the ev aluation h as not yet been comp leted" do | |
| 120 | it "shou ld link to an editab le evaluat ion" do | |
| 121 | expect (page).to have_link "Simple Ye s/No Evalu ation", hr ef: edit_c laim_evalu ation_path (@claim, @ claim.cont entions.fi rst.evalua tions.firs t) | |
| 122 | expect (page).to have_conte nt "Draft" | |
| 123 | end | |
| 124 | end | |
| 125 | ||
| 126 | context "w hen the ev aluation h as been co mpleted" d o | |
| 127 | before d o | |
| 128 | @claim .contentio ns.first.e valuations .each{|eva luation| e valuation. complete! @user } | |
| 129 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 130 | end | |
| 131 | ||
| 132 | it "shou ld link to a non-edi table page , show sta tus as Com pleted and provide a link to a PDF and X ML version " do | |
| 133 | expect (page).to have_link 'Simple Ye s/No Evalu ation', hr ef: claim_ evaluation _path(@cla im, @claim .contentio ns.first.e valuations .first) | |
| 134 | expect (page).to have_conte nt "Comple ted" | |
| 135 | expect (page).to have_link 'PDF', hre f: claim_e valuation_ path(@clai m, @claim. contention s.first.ev aluations. first, for mat: :pdf) | |
| 136 | expect (page).to have_link 'XML', hre f: claim_e valuation_ path(@clai m, @claim. contention s.first.ev aluations. first, for mat: :xml) | |
| 137 | expect (page).to have_link 'Spec', hr ef: admin_ evaluation _spec_path (@evaluati on_spec) | |
| 138 | end | |
| 139 | end | |
| 140 | ||
| 141 | context "w hen the co ntention s hows Veter ans VA cla im folder reviewed" do | |
| 142 | before d o | |
| 143 | @claim .contentio ns.first.u pdate_attr ibutes(cla im_folder_ reviewed: true) | |
| 144 | end | |
| 145 | ||
| 146 | it "shou ld not dis play the r ecords tab le" do | |
| 147 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 148 | expect (page).to have_selec tor('#reco rds_table' , visible: false) | |
| 149 | end | |
| 150 | ||
| 151 | context "when the Veterans V A claim fo lder optio n is chang ed and upd ated" do | |
| 152 | it "sh ould save the change and then display ac cordingly" do | |
| 153 | choo se 'conten tion_claim _folder_re viewed_fal se' | |
| 154 | clic k_button ' contention -submit' | |
| 155 | expe ct(page).t o have_sel ector('#re cords_tabl e', visibl e: false) | |
| 156 | end | |
| 157 | end | |
| 158 | end | |
| 159 | ||
| 160 | context "w hen a cont ention sho ws Veteran s VA claim folder no t reviewed " do | |
| 161 | before d o | |
| 162 | @claim .contentio ns.first.u pdate_attr ibutes(cla im_folder_ reviewed: false) | |
| 163 | end | |
| 164 | ||
| 165 | it "shou ld displa y the reco rds table" do | |
| 166 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 167 | expect (page).to have_selec tor('#reco rds_table' , visible: true) | |
| 168 | end | |
| 169 | ||
| 170 | context "when the Veterans V A claim fo lder optio n is chang ed and upd ated" do | |
| 171 | it "sh ould save the change and then display ac cordingly" do | |
| 172 | choo se 'conten tion_claim _folder_re viewed_tru e' | |
| 173 | clic k_button ' contention -submit' | |
| 174 | expe ct(page).t o have_sel ector('#re cords_tabl e', visibl e: false) | |
| 175 | end | |
| 176 | end | |
| 177 | end | |
| 178 | en d | |
| 179 | ||
| 180 | co ntext "whe n viewing a contenti on that is ready to be resolve d" do | |
| 181 | context "w hen the co ntention i ndicates n o diagnosi s" do | |
| 182 | before d o | |
| 183 | @claim .contentio ns.first.u pdate_attr ibutes(no_ diagnosis: true) | |
| 184 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 185 | end | |
| 186 | ||
| 187 | it "shou ld show th e details of the con tention an d prompt f or resolut ion" do | |
| 188 | expect (page).to have_conte nt "Claim: #{@claim. patient_na me} #{@cla im.created _at.to_dat e}" | |
| 189 | expect (page).to have_conte nt "Conten tion: #{@c laim.conte ntions.las t.name}" | |
| 190 | expect (page).to have_conte nt "Conten tion compl ete" | |
| 191 | expect (page).to have_no_co ntent "Sen t to an ad ministrato r for revi ew" | |
| 192 | expect (page).to have_conte nt "Send t o Administ rator for review" | |
| 193 | ## expe ct(page).t o have_lin k "Send", href: reso lve_claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 194 | end | |
| 195 | end | |
| 196 | ||
| 197 | context "w hen the co ntention h as all eva luations m arked as c ompleted" do | |
| 198 | before d o | |
| 199 | @claim .contentio ns.first.e valuations .each{|eva luation| e valuation. complete! @user } | |
| 200 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 201 | end | |
| 202 | ||
| 203 | it "shou ld show al l the deta ils of the contentio n and prom pt for res olution" d o | |
| 204 | expect (page).to have_conte nt "Claim: #{@claim. patient_na me} #{@cla im.created _at.to_dat e}" | |
| 205 | expect (page).to have_conte nt "Conten tion: #{@c laim.conte ntions.las t.name}" | |
| 206 | expect (page).to have_conte nt "Conten tion compl ete" | |
| 207 | expect (page).to have_no_co ntent "Sen t to an ad ministrato r for revi ew" | |
| 208 | expect (page).to have_conte nt "Send t o Administ rator for review" | |
| 209 | ## expe ct(page).t o have_lin k "Send", href: reso lve_claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 210 | end | |
| 211 | end | |
| 212 | en d | |
| 213 | ||
| 214 | co ntext "whe n a logged in user v iews a con tention th at they re solved and is ready for review " do | |
| 215 | before do | |
| 216 | @claim.c ontentions .first.upd ate_attrib utes(no_di agnosis: t rue, histo ry: "Patie nt History ", | |
| 217 | claim _folder_re viewed: tr ue) | |
| 218 | @claim.c ontentions .first.res olve!(@use r) | |
| 219 | visit cl aim_conten tion_path( @claim, @c laim.conte ntions.fir st) | |
| 220 | end | |
| 221 | ||
| 222 | it "should show that the conte ntion was sent to an administr ator" do | |
| 223 | expect(p age).to ha ve_content "Contenti on complet e" | |
| 224 | expect(p age).to ha ve_no_cont ent "Send to an Admi nistrator for review " | |
| 225 | expect(p age).to ha ve_content "Sent to Administra tor for re view" | |
| 226 | expect(p age).to ha ve_no_link "Add eval uation" | |
| 227 | end | |
| 228 | ||
| 229 | it "should not displ ay a submi t button " do | |
| 230 | expect(p age).to ha ve_no_sele ctor(".but ton primar y") | |
| 231 | end | |
| 232 | en d | |
| 233 | ||
| 234 | co ntext "whe n a superv isor views a resolve d contenti on" do | |
| 235 | let(:no_di agnosis) { false } | |
| 236 | let(:claim _folder_re viewed) { false } | |
| 237 | before do | |
| 238 | @claim.c ontentions .first.upd ate( | |
| 239 | no_dia gnosis: no _diagnosis , | |
| 240 | claim_ folder_rev iewed: cla im_folder_ reviewed, | |
| 241 | histor y: "some h istory her e" | |
| 242 | ) | |
| 243 | ||
| 244 | @claim.c ontentions .first.res olve!(@use r) | |
| 245 | ||
| 246 | @supervi sor = crea te(:superv isor) | |
| 247 | login_as @supervis or | |
| 248 | visit cl aim_conten tion_path( @claim, @c laim.conte ntions.fir st) | |
| 249 | end | |
| 250 | ||
| 251 | it "should show diag nosis and records te xt" do | |
| 252 | expect(p age).to ha ve_content ("Did you review the Veteran’s VA claim folder?") | |
| 253 | expect(p age).to ha ve_content ("no") | |
| 254 | end | |
| 255 | ||
| 256 | it "should not displ ay a submi t button " do | |
| 257 | expect(p age).to_no t have_but ton(".prim ary") | |
| 258 | end | |
| 259 | ||
| 260 | context "w hen the ve teran has the diagno sis" do | |
| 261 | it "does n't show u nchecked r ecord fiel ds" do | |
| 262 | expect (page).to have_conte nt("The Ve teran does not have a current diagnosis" ) | |
| 263 | end | |
| 264 | end | |
| 265 | ||
| 266 | context "w hen the ve teran does not have the diagno sis" do | |
| 267 | let(:no_ diagnosis) { true } | |
| 268 | let(:cla im_folder_ reviewed) { true } | |
| 269 | it "show s all unch ecked reco rd fields" do | |
| 270 | expect (find("#co ntention_n o_diagnosi s")).to be _checked | |
| 271 | end | |
| 272 | end | |
| 273 | ||
| 274 | context "w hen the cl aim folder has been reviewed" do | |
| 275 | let(:cla im_folder_ reviewed) { true } | |
| 276 | it "does n't show u nchecked r ecord fiel ds" do | |
| 277 | Conten tion::RECO RD_FIELD_L ABEL_MAP.v alues.each {|fieldna me| | |
| 278 | expe ct(page).n ot_to have _content(f ieldname) | |
| 279 | } | |
| 280 | end | |
| 281 | end | |
| 282 | ||
| 283 | context "w hen the cl aim folder has not b een review ed" do | |
| 284 | it "show s all unch ecked reco rd fields" do | |
| 285 | Conten tion::RECO RD_FIELD_L ABEL_MAP.v alues.each {|fieldna me| | |
| 286 | expe ct(page).t o have_con tent(field name) | |
| 287 | } | |
| 288 | end | |
| 289 | end | |
| 290 | ||
| 291 | context "w hen there is another contentio n for this claim" do | |
| 292 | before d o | |
| 293 | @claim .contentio ns << crea te(:conten tion) | |
| 294 | @claim .contentio ns.last.up date_attri butes(name : 'Content ion 2', hi story: "Pa tient Hist ory") | |
| 295 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 296 | end | |
| 297 | ||
| 298 | # it "sho uld should allow the user to s elect the other cont ention fro m a select drop down ", js: tru e do | |
| 299 | # expec t(page).to have_sele ct 'conten tion_name' , with_opt ions: [@cl aim.conten tions.firs t.name, @c laim.conte ntions.las t.name] | |
| 300 | # selec t("Content ion 2", fr om: "conte ntion_name ") | |
| 301 | # expec t(page).to have_cont ent "Conte ntion: Con tention 2" | |
| 302 | # expec t(page).to have_sele ct 'conten tion_name' , with_opt ions: [@cl aim.conten tions.firs t.name] | |
| 303 | # end | |
| 304 | end | |
| 305 | en d | |
| 306 | ||
| 307 | co ntext "whe n viewing a contenti on that ha s been rev iewed" do | |
| 308 | before do | |
| 309 | @claim.c ontentions .first.upd ate( | |
| 310 | no_dia gnosis: fa lse, | |
| 311 | claim_ folder_rev iewed: tru e, | |
| 312 | histor y: "some h istory her e" | |
| 313 | ) | |
| 314 | @claim.c ontentions .first.res olve!(@use r) | |
| 315 | end | |
| 316 | ||
| 317 | context "w hen there' s no user that revie wed the co ntention" do | |
| 318 | before d o | |
| 319 | @claim .contentio ns.first.r eview! | |
| 320 | end | |
| 321 | ||
| 322 | it "shou ld show th e contenti on" do | |
| 323 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 324 | end | |
| 325 | end | |
| 326 | ||
| 327 | context "w hen there' s a user t hat review ed the con tention" d o | |
| 328 | before d o | |
| 329 | @super visor = cr eate(:supe rvisor) | |
| 330 | @claim .contentio ns.first.r eview!(@su pervisor.i d) | |
| 331 | end | |
| 332 | ||
| 333 | it "shou ld show th e contenti on and who it was re viewed by" do | |
| 334 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 335 | expect (page).to have_conte nt "Approv ed by: #{@ supervisor .last_name }" | |
| 336 | end | |
| 337 | end | |
| 338 | en d | |
| 339 | end | |
| 340 | ||
| 341 | cont ext "when the conten tion has a t least tw o evaluati ons" do | |
| 342 | be fore do | |
| 343 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_1, claim: @c laim, user : @user) | |
| 344 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_3, claim: @c laim, user : @user) | |
| 345 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_2, claim: @c laim, user : @user) | |
| 346 | en d | |
| 347 | ||
| 348 | it "should l ist the ev aluations in ascendi ng order b y creation date/time " do | |
| 349 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 350 | expect(pag e.text).to match(/Sp ec01.*Spec 03.*Spec02 /) | |
| 351 | visit clai m_path(@cl aim) | |
| 352 | expect(pag e.text).to match(/Sp ec01.*Spec 03.*Spec02 /) | |
| 353 | en d | |
| 354 | end | |
| 355 | ||
| 356 | cont ext "when the conten tion has m utliple ev aluations assigned t o differen t users" d o | |
| 357 | be fore do | |
| 358 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_1, claim: @c laim, user : @user) | |
| 359 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_3, claim: @c laim, user : @user) | |
| 360 | @claim.con tentions.f irst.evalu ations.las t.complete ! @user | |
| 361 | @claim.con tentions.f irst.evalu ations << Evaluation .new(evalu ation_spec : @spec_2, claim: @c laim, user : @user_2) | |
| 362 | en d | |
| 363 | ||
| 364 | it "should o nly allow the examin er user th at owns th e evaluati on to dele te uncompl eted evalu ations" do | |
| 365 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 366 | expect(pag e).to have _link 'Del ete', href : "/claims /#{@claim. id}/evalua tions/#{@c laim.conte ntions.fir st.evaluat ions.first .id}" | |
| 367 | click_link 'Delete' | |
| 368 | expect(pag e).to have _content " Successful ly deleted evaluatio n" | |
| 369 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 370 | expect(pag e).to have _no_link ' Delete' | |
| 371 | en d | |
| 372 | end | |
| 373 | end | |
| 374 | end | |
| 375 | ||
| 376 | describe "PUT /cla ims/:claim _id/conten tions/:id" do | |
| 377 | before do | |
| 378 | @cla im = creat e(:claim) | |
| 379 | @cla im.content ions << cr eate(:cont ention, hi story: "Pa tient Hist ory") | |
| 380 | end | |
| 381 | ||
| 382 | it "sh ould updat e the cont ention's a ttributes" do | |
| 383 | visi t claim_co ntention_p ath(@claim , @claim.c ontentions .first) | |
| 384 | chec k 'The Vet eran does not have a current d iagnosis a ssociated with the c laimed con tention li sted above .' | |
| 385 | fill _in "Descr ibe the hi story of t he Veteran ’s conditi on", with: "History goes here" | |
| 386 | find (:css, '#c ontention_ claim_fold er_reviewe d_true').s et(true) | |
| 387 | chec k "Militar y service treatment records" | |
| 388 | clic k_button ' contention -submit' | |
| 389 | expe ct(page).t o have_con tent 'Cont ention upd ated' | |
| 390 | expe ct(page).t o have_con tent 'Hist ory goes h ere' | |
| 391 | # exp ect(find(" #contentio n_no_diagn osis")).to be_checke d | |
| 392 | expe ct(find('# contention _claim_fol der_review ed_true')) .to be_che cked | |
| 393 | expe ct(find("# contention _no_diagno sis")).to be_checked | |
| 394 | end | |
| 395 | ||
| 396 | contex t "when a contention does not have any e valuations associate d with it" do | |
| 397 | befo re do | |
| 398 | @u ser_2.role s = ["exam iner"] | |
| 399 | @u ser_2.save | |
| 400 | end | |
| 401 | ||
| 402 | # it "should al low an exa miner to a dd an eval uation to a contenti on", js: t rue do | |
| 403 | # v isit claim _contentio n_path(@cl aim, @clai m.contenti ons.first) | |
| 404 | # e xpect(page ).to have_ content "E valuations " | |
| 405 | # c lick_link 'Evaluatio ns' | |
| 406 | # c lick_link 'Add evalu ation' | |
| 407 | # s elect('Gre en, Ms', f rom: 'eval uation_use r_id') | |
| 408 | # f ind('a spa n', text: '--Select a new eval uation').c lick | |
| 409 | # f ind('li', text: 'Sim ple Yes/No Evaluatio n').click | |
| 410 | # c lick_butto n 'Add eva luation' | |
| 411 | # e xpect(page ).to have_ content "A dded evalu ation to c ontention" | |
| 412 | # c lick_link 'Evaluatio ns' | |
| 413 | # e xpect(page ).to have_ content "S imple Yes/ No Evaluat ion" | |
| 414 | # p age.assert _selector( 'span', vi sible: fal se, text: "Assigner: #{@user.i d}") | |
| 415 | # | |
| 416 | # end | |
| 417 | ||
| 418 | it " should not allow an evaluation to be add ed without an evalua tion speci fication" do | |
| 419 | vi sit new_cl aim_evalua tion_path( @claim, co ntention_i d: @claim. contention s.first.id ) | |
| 420 | cl ick_button 'Add eval uation' | |
| 421 | ex pect(page) .to have_c ontent "Er ror adding evaluatio n to conte ntion: Eva luation sp ec can't b e blank" | |
| 422 | end | |
| 423 | ||
| 424 | # it "should al low search ing of eva luations b y keywords ", js: tru e do | |
| 425 | # v isit new_c laim_evalu ation_path (@claim, c ontention_ id: @claim .contentio ns.first.i d) | |
| 426 | # f ind('a spa n', text: '--Select a new eval uation').c lick | |
| 427 | # e xpect(page ).to have_ selector(' .active-re sult', cou nt: 5) | |
| 428 | # f ill_in 'ch osen-searc h', :with => 'testin g' | |
| 429 | # e xpect(page ).to have_ selector(' .active-re sult', cou nt: 1) | |
| 430 | # end | |
| 431 | ||
| 432 | it " should not blow up i f the user tries to link a bla nk evaluat ion" do | |
| 433 | vi sit new_cl aim_evalua tion_path( @claim, co ntention_i d: @claim. contention s.first.id ) | |
| 434 | cl ick_button 'Link eva luation' | |
| 435 | ex pect(page) .to have_c ontent 'Co ntention u pdated' | |
| 436 | end | |
| 437 | end | |
| 438 | ||
| 439 | contex t "when a contention has some evaluation s, as do o ther conte ntions for the same claim" do | |
| 440 | befo re do | |
| 441 | @c laim.conte ntions << create(:co ntention, name: "My other arm hurts") | |
| 442 | @c laim.conte ntions.fir st.evaluat ions << Ev aluation.n ew(evaluat ion_spec: @evaluatio n_spec, cl aim: @clai m, user: @ user) | |
| 443 | end | |
| 444 | ||
| 445 | it " should all ow an exam iner to li nk an exis ting evalu ation for that claim to a cont ention" do | |
| 446 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 447 | ex pect(page) .to have_c ontent @ev aluation_s pec.title | |
| 448 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.last) | |
| 449 | ex pect(page) .to have_n o_content @evaluatio n_spec.tit le | |
| 450 | cl ick_link ' Add evalua tion' | |
| 451 | ex pect(page) .to have_s elect 'con tention[ev aluation_i ds][]', wi th_options : [@evalua tion_spec. title] | |
| 452 | se lect @eval uation_spe c.title, f rom: 'cont ention[eva luation_id s][]' | |
| 453 | cl ick_button 'Link eva luation' | |
| 454 | ex pect(page) .to have_c ontent 'Co ntention u pdated' | |
| 455 | ex pect(page) .to have_c ontent @ev aluation_s pec.title | |
| 456 | end | |
| 457 | end | |
| 458 | end | |
| 459 | ||
| 460 | describe "POST /cl aims/:clai m_id/conte ntions/:co ntention_i d/resolve" do | |
| 461 | before do | |
| 462 | @cla im = creat e :claim | |
| 463 | @cla im.content ions << cr eate(:cont ention, hi story: "Pa tient Hist ory", | |
| 464 | no_di agnosis: t rue, claim _folder_re viewed: tr ue) | |
| 465 | end | |
| 466 | ||
| 467 | contex t "when a contention 's claim f older is n ot reviewe d but at l east one d ocument ha s been rev iewed" do | |
| 468 | # it "successfu lly resolv es the con tention", js: true d o | |
| 469 | # c ontention = @claim.c ontentions .first | |
| 470 | # v isit claim _contentio n_path(@cl aim, @clai m.contenti ons.first) | |
| 471 | # c lick_link "Records" | |
| 472 | # c hoose "con tention_cl aim_folder _reviewed_ false" | |
| 473 | # c heck "cont ention_rev iewed_mili tary_servi ce_personn el_records " | |
| 474 | # c lick_butto n 'content ion-submit ' | |
| 475 | # c lick_link "Send to A dministrat or for rev iew" | |
| 476 | # e xpect(page ).to have_ content "C ontention has been r esolved an d sent to administra tor for re view." | |
| 477 | # e xpect(page ).to have_ content "R esolved" | |
| 478 | # end | |
| 479 | end | |
| 480 | ||
| 481 | contex t "when a contention 's claim f older is n ot reviewe d and no d ocuments h ave been r eviewed" d o | |
| 482 | it " displays a n error" d o | |
| 483 | co ntention = @claim.co ntentions. first | |
| 484 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 485 | ch oose "cont ention_cla im_folder_ reviewed_f alse" | |
| 486 | cl ick_button 'contenti on-submit' | |
| 487 | cl ick_link " Send to Ad ministrato r for revi ew" | |
| 488 | ex pect(page) .to have_c ontent "At least one document must be re viewed if the Vetera n's VA fol der has no t been rev iewed" | |
| 489 | end | |
| 490 | end | |
| 491 | ||
| 492 | contex t "when a contention has a bla nk history " do | |
| 493 | it " displays a n error" d o | |
| 494 | co ntention = @claim.co ntentions. first | |
| 495 | co ntention.u pdate_attr ibutes(his tory: nil) | |
| 496 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 497 | cl ick_link " Send" | |
| 498 | ex pect(page) .to have_c ontent "Co ntention h istory can not be bla nk." | |
| 499 | end | |
| 500 | end | |
| 501 | ||
| 502 | contex t "when a contention has not p icked whet her a clai m folder h as been re viewed" do | |
| 503 | it " displays a n error" d o | |
| 504 | co ntention = @claim.co ntentions. first | |
| 505 | co ntention.u pdate_attr ibutes(cla im_folder_ reviewed: nil) | |
| 506 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 507 | cl ick_link " Send" | |
| 508 | ex pect(page) .to have_c ontent "A contention claim fol der review ed option must be pi cked." | |
| 509 | end | |
| 510 | end | |
| 511 | ||
| 512 | contex t "when a contention has a bla nk history and no cl aim folder reviewed option pic ked" do | |
| 513 | it " displays a n error" d o | |
| 514 | co ntention = @claim.co ntentions. first | |
| 515 | co ntention.u pdate_attr ibutes(cla im_folder_ reviewed: nil, histo ry: nil) | |
| 516 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 517 | cl ick_link " Send" | |
| 518 | ex pect(page) .to have_c ontent "Co ntention h istory can not be bla nk. A cont ention cla im folder reviewed o ption must be picked ." | |
| 519 | end | |
| 520 | end | |
| 521 | ||
| 522 | contex t "when a contention has a no diagnosis indicator, even if a ll evaluat ions are n ot complet ed" do | |
| 523 | befo re do | |
| 524 | @c laim.conte ntions.fir st.evaluat ions << Ev aluation.n ew(evaluat ion_spec: @evaluatio n_spec, cl aim: @clai m, user: @ user) | |
| 525 | @c laim.conte ntions.fir st.update_ attributes (no_diagno sis: true, history: "Patient H istory", c laim_folde r_reviewed : true) | |
| 526 | end | |
| 527 | ||
| 528 | it " should ena ble the ex aminer to resolve th e contenti on" do | |
| 529 | ex pect(VBMSJ ob).to rec eive(:perf orm_later) .once | |
| 530 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 531 | ex pect(page) .to have_c ontent "Co ntention c omplete" | |
| 532 | ex pect(page) .to have_n o_content "Sent to a n administ rator for review" | |
| 533 | ex pect(page) .to have_c ontent "Se nd to Admi nistrator for review " | |
| 534 | ex pect(page) .to have_l ink "Send" , href: re solve_clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 535 | cl ick_link " Send" | |
| 536 | ex pect(page) .to have_c ontent "Co ntention h as been re solved and sent to a dministrat or for rev iew." | |
| 537 | ex pect(page) .to have_c ontent "Re solved" | |
| 538 | end | |
| 539 | end | |
| 540 | ||
| 541 | contex t "when a contention shows Vet erans VA c laim folde r reviewed " do | |
| 542 | befo re do | |
| 543 | @c laim.conte ntions.fir st.update_ attributes (claim_fol der_review ed: true, history: " Patient Hi story") | |
| 544 | end | |
| 545 | ||
| 546 | it " should not display t he records table" do | |
| 547 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 548 | ex pect(page) .to have_s elector('# records_ta ble', visi ble: false ) | |
| 549 | end | |
| 550 | end | |
| 551 | ||
| 552 | contex t "when a contention shows Vet erans VA c laim folde r not revi ewed" do | |
| 553 | befo re do | |
| 554 | @c laim.conte ntions.fir st.update_ attributes (claim_fol der_review ed: false) | |
| 555 | end | |
| 556 | ||
| 557 | it " should not display t he records table" do | |
| 558 | vi sit claim_ contention _path(@cla im, @claim .contentio ns.first) | |
| 559 | ex pect(page) .to have_s elector('# records_ta ble', visi ble: true) | |
| 560 | end | |
| 561 | end | |
| 562 | ||
| 563 | contex t "when a contention has multi ple evalua tions" do | |
| 564 | befo re do | |
| 565 | @p hase_1_spe c = @evalu ation_spec | |
| 566 | @p hase_2_spe c = create (:diabetes _spec) | |
| 567 | @p hase_1_eva luation = Evaluation .new(claim : @claim, evaluation _spec: @ph ase_1_spec , user: @u ser) | |
| 568 | @p hase_2_eva luation = Evaluation .new(claim : @claim, evaluation _spec: @ph ase_2_spec , user: @u ser) | |
| 569 | @c laim.conte ntions.fir st.evaluat ions << @p hase_1_eva luation | |
| 570 | @c laim.conte ntions.fir st.evaluat ions << @p hase_2_eva luation | |
| 571 | end | |
| 572 | ||
| 573 | cont ext "when a contenti on has all evaluatio ns complet ed" do | |
| 574 | be fore do | |
| 575 | @claim.con tentions.f irst.evalu ations.eac h{|evaluat ion| evalu ation.comp lete! @use r } | |
| 576 | en d | |
| 577 | ||
| 578 | it "should e nable the examiner t o resolve the conten tion" do | |
| 579 | expect(VBM SJob).to r eceive(:pe rform_late r).twice | |
| 580 | visit clai m_contenti on_path(@c laim, @cla im.content ions.first ) | |
| 581 | expect(pag e).to have _content " Contention complete" | |
| 582 | expect(pag e).to have _no_conten t "Sent to an admini strator fo r review" | |
| 583 | expect(pag e).to have _content " Send to Ad ministrato r for revi ew" | |
| 584 | expect(pag e).to have _link "Sen d", href: resolve_cl aim_conten tion_path( @claim, @c laim.conte ntions.fir st) | |
| 585 | click_link "Send" | |
| 586 | expect(pag e).to have _content " Contention has been resolved a nd sent to administr ator for r eview." | |
| 587 | expect(pag e).to have _content " Resolved" | |
| 588 | en d | |
| 589 | ||
| 590 | co ntext "whe n the user completin g the cont ention is under revi ew" do | |
| 591 | before do | |
| 592 | @user.up date_attri butes(is_u nder_revie w: true) | |
| 593 | end | |
| 594 | ||
| 595 | it "should not send the evalua tion to th e backend" do | |
| 596 | expect(V BMSJob).no t_to recei ve(:perfor m_later) | |
| 597 | visit cl aim_conten tion_path( @claim, @c laim.conte ntions.fir st) | |
| 598 | click_li nk "Send" | |
| 599 | expect(p age).to ha ve_content "Contenti on has bee n resolved and sent to adminis trator for review." | |
| 600 | expect(p age).to ha ve_content "Resolved " | |
| 601 | end | |
| 602 | en d | |
| 603 | ||
| 604 | co ntext "for a content ion with a phase 1 a nd phase 2 evaluatio n do" do | |
| 605 | context "w hen Phase 2 is not e nabled" do | |
| 606 | before d o | |
| 607 | ENV['E NABLE_PHAS E_2'] = "f alse" | |
| 608 | end | |
| 609 | ||
| 610 | after do | |
| 611 | ENV.de lete "ENAB LE_PHASE_2 " | |
| 612 | end | |
| 613 | ||
| 614 | it "shou ld resolve the conte ntion and send all e xams to VB MS" do | |
| 615 | allow( @phase_1_e valuation) .to receiv e(:render_ html).and_ return "<h tml>GO</ht ml>" | |
| 616 | expect (VBMSJob). to receive (:perform_ later).twi ce | |
| 617 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 618 | click_ link "Send " | |
| 619 | expect (page).to have_conte nt "Conten tion has b een resolv ed and sen t to admin istrator f or review. " | |
| 620 | expect (page).to have_conte nt "Resolv ed" | |
| 621 | end | |
| 622 | end | |
| 623 | ||
| 624 | context "w hen Phase 2 is enabl ed" do | |
| 625 | before d o | |
| 626 | ENV['E NABLE_PHAS E_2'] = "t rue" | |
| 627 | ENV["P HASE_2_BOD Y_SYSTEMS" ] = '["End ocrine"]' | |
| 628 | end | |
| 629 | ||
| 630 | after do | |
| 631 | ENV.de lete "ENAB LE_PHASE_2 " | |
| 632 | ENV.de lete "PHAS E_2_BODY_S YSTEMS" | |
| 633 | end | |
| 634 | ||
| 635 | it "shou ld resolve the conte ntion and send all e valuations to VBMS a nd VLER-DA S dependei ng on body system" d o | |
| 636 | expect (VlerDASJo b).to rece ive(:perfo rm_later). with(@phas e_2_evalua tion) | |
| 637 | expect (VBMSJob). to receive (:perform_ later).wit h(@phase_1 _evaluatio n) | |
| 638 | visit claim_cont ention_pat h(@claim, @claim.con tentions.f irst) | |
| 639 | click_ link "Send " | |
| 640 | expect (page).to have_conte nt "Conten tion has b een resolv ed and sen t to admin istrator f or review. " | |
| 641 | expect (page).to have_conte nt "Resolv ed" | |
| 642 | end | |
| 643 | end | |
| 644 | en d | |
| 645 | end | |
| 646 | end | |
| 647 | end | |
| 648 | ||
| 649 | describe "PUT /cla ims/:claim _id/conten tions/:con tention_id /accept" d o | |
| 650 | contex t "when th e logged i n user is a supervis or" do | |
| 651 | befo re do | |
| 652 | @s upervisor = create(: supervisor ) | |
| 653 | lo gin_as @su pervisor | |
| 654 | end | |
| 655 | ||
| 656 | cont ext "when a contenti on has bee n resolved " do | |
| 657 | be fore do | |
| 658 | @claim = c reate(:cla im) | |
| 659 | @contentio n = create (:contenti on, histor y: "Patien t History" , claim_fo lder_revie wed: true) | |
| 660 | @claim.con tentions < < @content ion | |
| 661 | @evaluatio n_spec = c reate(:dia betes_spec ) | |
| 662 | @evaluatio n = Evalua tion.new(c laim: @cla im, evalua tion_spec: @evaluati on_spec, u ser: @user ) | |
| 663 | @claim.con tentions.f irst.evalu ations << @evaluatio n | |
| 664 | @evaluatio n.complete ! @user | |
| 665 | @contentio n.resolve! (@user) | |
| 666 | en d | |
| 667 | ||
| 668 | it "displays the revie wed at dat e" do | |
| 669 | expect(VBM SJob).to r eceive(:pe rform_late r).with @e valuation | |
| 670 | visit clai m_contenti on_path(@c laim, @con tention) | |
| 671 | click_link 'Accept' | |
| 672 | visit clai m_contenti on_path(@c laim, @con tention) | |
| 673 | expect(pag e).to have _content " Approved a t:" | |
| 674 | en d | |
| 675 | ||
| 676 | it "should a llow the u ser to acc ept the co ntention, which send the conte ntion's ev aluations to the bac kend" do | |
| 677 | expect(VBM SJob).to r eceive(:pe rform_late r).with @e valuation | |
| 678 | visit clai m_contenti on_path(@c laim, @con tention) | |
| 679 | expect(pag e).to have _link 'Acc ept', href : accept_c laim_conte ntion_path (@claim, @ contention ) | |
| 680 | click_link 'Accept' | |
| 681 | expect(pag e).to have _content " Contention has been accepted." | |
| 682 | expect(pag e).to have _no_link @ contention .name, hre f: claim_c ontention_ path(@clai m, @conten tion) | |
| 683 | en d | |
| 684 | end | |
| 685 | end | |
| 686 | end | |
| 687 | ||
| 688 | describe "PUT /cla ims/:claim _id/conten tions/:con tention_id /reject" d o | |
| 689 | contex t "when th e logged i n user is a supervis or" do | |
| 690 | befo re do | |
| 691 | @s upervisor = create(: supervisor ) | |
| 692 | lo gin_as @su pervisor | |
| 693 | end | |
| 694 | ||
| 695 | cont ext "when a contenti on has bee n resolved " do | |
| 696 | be fore do | |
| 697 | @claim = c reate(:cla im) | |
| 698 | @contentio n = create (:contenti on, histor y: "Patien t History" , claim_fo lder_revie wed: true) | |
| 699 | @claim.con tentions < < @content ion | |
| 700 | @evaluatio n_spec = c reate(:dia betes_spec ) | |
| 701 | @evaluatio n = Evalua tion.new( | |
| 702 | claim: @ claim, | |
| 703 | evaluati on_spec: @ evaluation _spec, | |
| 704 | doc: bui ld(:diabet es_doc).do c, | |
| 705 | user: @u ser) | |
| 706 | @claim.con tentions.f irst.evalu ations << @evaluatio n | |
| 707 | @evaluatio n.complete ! @supervi sor | |
| 708 | @contentio n.resolve! (@supervis or) | |
| 709 | en d | |
| 710 | ||
| 711 | it "should a llow the u ser to acc ept the co ntention, which send the conte ntion's ev aluations to the bac kend" do | |
| 712 | visit clai m_contenti on_path(@c laim, @con tention) | |
| 713 | expect(pag e).to have _link 'Rej ect', href : new_clai m_contenti on_rejecti on_path(@c laim, @con tention) | |
| 714 | click_link 'Reject' | |
| 715 | expect(pag e.current_ path).to e q new_clai m_contenti on_rejecti on_path(@c laim, @con tention) | |
| 716 | en d | |
| 717 | end | |
| 718 | end | |
| 719 | end | |
| 720 | end |
Araxis Merge (but not the data content of this report) is Copyright © 1993-2016 Araxis Ltd (www.araxis.com). All rights reserved.