Skip to content

Commit

Permalink
Allow enforce_dependencies attribute to be nil (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Brad Schrag <[email protected]>
  • Loading branch information
bschrag620 and bschrag620 authored Dec 12, 2023
1 parent 64a8e91 commit e291c0d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/parse_packwerk/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Package < T::Struct
extend T::Sig

const :name, String
const :enforce_dependencies, T.any(T::Boolean, String)
const :enforce_dependencies, T.nilable(T.any(T::Boolean, String))
const :enforce_privacy, T.any(T::Boolean, String), default: false
const :public_path, String, default: DEFAULT_PUBLIC_PATH
const :metadata, MetadataYmlType
Expand Down
19 changes: 19 additions & 0 deletions spec/parse_packwerk_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@
it { is_expected.to have_matching_package expected_domain_package, expected_package_todo }
end

context 'package does not declare enforce_dependencies' do
before do
write_file('package.yml', <<~CONTENTS)
# A list of this package's dependencies
# Note that packages in this list require their own `package.yml` file
dependencies:
CONTENTS
end

let(:valid_package) {
ParsePackwerk::Package.from(Pathname.new('package.yml'))
}

it 'should be valid' do
expect { valid_package }.to_not raise_error
end
end

context 'in app that has metadata' do
before do
write_file('packs/package1/package.yml', <<~CONTENTS)
Expand Down

0 comments on commit e291c0d

Please sign in to comment.