Skip to content

Commit

Permalink
Craig/appeals 46196 (#21689)
Browse files Browse the repository at this point in the history
* fix query, tested locally

* add basic test to verify csv downloads aren't broken
  • Loading branch information
craigrva authored May 21, 2024
1 parent 8181165 commit 6579ea9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def appeals_distributed

def check_environment
return true if Rails.env.development?
return true if Rails.env.test?
return true if Rails.deploy_env?(:demo)

redirect_to "/unauthorized"
Expand Down
3 changes: 2 additions & 1 deletion app/models/vacols/case_docket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ class DocketNumberCentennialLoop < StandardError; end

# this version of the query should not be used during distribution it is only intended for reporting usage
SELECT_READY_APPEALS_ADDITIONAL_COLS = "
select BFKEY, BFD19, BFDLOOUT, BFMPRO, BFCURLOC, BFAC, BFHINES, TINUM, TITRNUM, AOD, BFCORKEY, BFCORLID
select BFKEY, BFD19, BFDLOOUT, BFMPRO, BFCURLOC, BFAC, BFHINES, TINUM, TITRNUM, AOD, BFMEMID, BFDPDCN,
BFCORKEY, BFCORLID
#{FROM_READY_APPEALS}
"

Expand Down
26 changes: 26 additions & 0 deletions spec/controllers/case_distribution_levers_tests_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

describe CaseDistributionLeversTestsController do
before do
Timecop.freeze(Time.utc(2024, 1, 1, 12, 0, 0))
User.authenticate!(user: User.system_user)
end

context "#appeals_ready_to_distribute" do
it "downloads a properly named CSV file" do
get :appeals_ready_to_distribute, format: :csv

expect(response.headers["Content-Type"]).to eq("text/csv")
expect(response.headers["Content-Disposition"]).to include("appeals_ready_to_distribute_20240101-0700.csv")
end
end

context "#appeals_distributed" do
it "downloads a properly named CSV file" do
get :appeals_distributed, format: :csv

expect(response.headers["Content-Type"]).to eq("text/csv")
expect(response.headers["Content-Disposition"]).to include("distributed_appeals_20240101-0700.csv")
end
end
end

0 comments on commit 6579ea9

Please sign in to comment.