Skip to content

Commit

Permalink
Distinguish BEAAM appeals (#16853)
Browse files Browse the repository at this point in the history
Resolves goal 2 of option 1 in the [Tech Spec](#16508)
> 2. Enable application code to identify BEAAM appeals.

### Description
Enables application code to identify BEAAM appeals.

### Acceptance Criteria
- [ ] Code compiles correctly
- [ ] `appeal.beaam?` returns `true` for all BEAAM appeals in Caseflow prod environment
  • Loading branch information
yoomlam committed Oct 15, 2021
1 parent d4ec5fe commit ccb1c27
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/models/appeal.rb
Expand Up @@ -8,6 +8,7 @@
# rubocop:disable Metrics/ClassLength
class Appeal < DecisionReview
include AppealConcern
include BeaamAppealConcern
include BgsService
include Taskable
include PrintsTaskTree
Expand Down
19 changes: 19 additions & 0 deletions app/models/concerns/beaam_appeal_concern.rb
@@ -0,0 +1,19 @@
# frozen_string_literal: true

# This concern is used to identify appeals associated with the BEAAM program.
# Fulfills goal 2 of option 1 in the Tech Spec: Enable application code to identify BEAAM appeals.
# See https://github.com/department-of-veterans-affairs/caseflow/wiki/BEAAM-Appeals
# and Tech Spec https://github.com/department-of-veterans-affairs/caseflow/issues/16508
module BeaamAppealConcern
extend ActiveSupport::Concern

# Copied from https://github.com/department-of-veterans-affairs/caseflow/pull/8733/files
BEAAM_CASE_IDS = [25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
50, 51,
53].freeze

def beaam?
BEAAM_CASE_IDS.include?(id) && Rails.env.production?
end
end
17 changes: 17 additions & 0 deletions spec/models/concerns/beaam_appeal_concern_spec.rb
@@ -0,0 +1,17 @@
# frozen_string_literal: true

describe BeaamAppealConcern do
describe "#beaam?" do
before { allow(Rails.env).to receive(:production?).and_return(true) }

let(:appeal) { create(:appeal, id: 1) }
subject { appeal.beaam? }
context "non-BEAAM appeal" do
it { is_expected.to eq false }
end
context "BEAAM appeal" do
let(:appeal) { create(:appeal, id: BeaamAppealConcern::BEAAM_CASE_IDS.sample) }
it { is_expected.to eq true }
end
end
end

0 comments on commit ccb1c27

Please sign in to comment.