Skip to content

Instantly share code, notes, and snippets.

@ekohl
Created June 15, 2018 13:38
Show Gist options
  • Save ekohl/f86924dc00197890a831d57fd6329324 to your computer and use it in GitHub Desktop.
Save ekohl/f86924dc00197890a831d57fd6329324 to your computer and use it in GitHub Desktop.
describe MetadataJsonLint do
describe '.validate_requirements!' do
context 'empty requirements' do
let :requirements do
[]
end
it { expect { described_class.validate_requirements!(requirements) }.not_to raise_error }
end
context 'with pe' do
let :requirements do
[
{'name' => 'pe'}
]
end
it do
expect(described_class).to receive('warn').with(:requirements, "The 'pe' requirement is no longer supported by the Forge.")
expect { described_class.validate_requirements!(requirements) }.not_to raise_error
end
end
context 'with invalid requirement' do
let :requirements do
[
{'version_requirement' => 'a'}
]
end
it do
expect(described_class).to receive('error').with(:dependencies, "Invalid 'version_requirement' field in metadata.json: Unparsable version range: \"a\"")
expect { described_class.validate_requirements!(requirements) }.not_to raise_error
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment