-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5885 from ministryofjustice/ap-4508-add-applicati…
…on-link-types ap-4508: Add class to handle linked_application_types
- Loading branch information
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |