Skip to content

Commit

Permalink
Merge pull request #5885 from ministryofjustice/ap-4508-add-applicati…
Browse files Browse the repository at this point in the history
…on-link-types

ap-4508: Add class to handle linked_application_types
  • Loading branch information
kmahern authored Oct 30, 2023
2 parents 280b738 + a111cb8 commit 8d26efa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/models/linked_application_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class LinkedApplicationType
LinkTypeStruct = Struct.new(:code, :description)

LINK_TYPES = [
LinkTypeStruct.new(code: "FAMILY", description: "Family"),
LinkTypeStruct.new(code: "LEGAL", description: "Legal"),
].freeze

def self.all
LINK_TYPES
end
end
17 changes: 17 additions & 0 deletions spec/models/linked_application_type_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require "rails_helper"

RSpec.describe LinkedApplicationType do
describe ".all" do
it "returns a collection of Link types" do
described_class.all.each do |link_type|
expect(link_type.respond_to?(:code)).to be true
expect(link_type.respond_to?(:description)).to be true
end
end

it "returns expected collection attribute values" do
expect(described_class.all.map(&:description)).to match_array %w[Family Legal]
expect(described_class.all.map(&:code)).to match_array %w[FAMILY LEGAL]
end
end
end

0 comments on commit 8d26efa

Please sign in to comment.