summaryrefslogtreecommitdiff
path: root/spec/support/shared/unit
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/shared/unit')
-rw-r--r--spec/support/shared/unit/platform_introspector.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/support/shared/unit/platform_introspector.rb b/spec/support/shared/unit/platform_introspector.rb
index 9f42c985f8..df24370fde 100644
--- a/spec/support/shared/unit/platform_introspector.rb
+++ b/spec/support/shared/unit/platform_introspector.rb
@@ -32,6 +32,7 @@ shared_examples_for "a platform introspector" do
# The following @platform_hash keys are used for testing version constraints
@platform_hash['exact_match'] = { '1.2.3' => 'exact', '>= 1.0' => 'not exact'}
@platform_hash['multiple_matches'] = { '~> 2.3.4' => 'matched ~> 2.3.4', '>= 2.3' => 'matched >=2.3' }
+ @platform_hash['invalid_cookbook_version'] = {'>= 21' => 'Matches a single number'}
@platform_hash['successful_matches'] = { '< 3.0' => 'matched < 3.0', '>= 3.0' => 'matched >= 3.0' }
@platform_family_hash = {
@@ -95,6 +96,12 @@ shared_examples_for "a platform introspector" do
expect {platform_introspector.value_for_platform(@platform_hash)}.to raise_error(RuntimeError)
end
+ it 'should not require .0 to match >= 21.0' do
+ node.automatic_attrs[:platform] = 'invalid_cookbook_version'
+ node.automatic_attrs[:platform_version] = '21'
+ expect(platform_introspector.value_for_platform(@platform_hash)).to eq('Matches a single number')
+ end
+
it 'should return the value for that match' do
node.automatic_attrs[:platform] = 'successful_matches'
node.automatic_attrs[:platform_version] = '2.9'