diff options
author | Jordan Evans <jordane@osuosl.org> | 2015-04-22 15:23:29 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2015-10-24 14:40:26 -0700 |
commit | a4ddaeffa003dd3ce3b666555797c928d28ff25e (patch) | |
tree | ea138c7dc1fb7b454f2a4ce46567fdcedaf2555e /spec/support/shared/unit | |
parent | 71343e98f9239e1c6362dfbdc3c87fdb70003ba9 (diff) | |
download | chef-a4ddaeffa003dd3ce3b666555797c928d28ff25e.tar.gz |
add a failing test case for value_for_platform
Specifically this test case fails when matching a platform that
has a single number for its version, like fedora.
Diffstat (limited to 'spec/support/shared/unit')
-rw-r--r-- | spec/support/shared/unit/platform_introspector.rb | 7 |
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' |