Add support for pre_releases argument to the gem state

This commit is contained in:
Rob Messick 2014-07-25 12:05:14 -07:00
parent 84d8e71a00
commit 4549ef25a2
2 changed files with 11 additions and 6 deletions

View File

@ -32,7 +32,8 @@ def installed(name, # pylint: disable=C0103
user=None,
version=None,
rdoc=False,
ri=False): # pylint: disable=C0103
ri=False,
pre_releases=False): # pylint: disable=C0103
'''
Make sure that a gem is installed.
@ -61,6 +62,9 @@ def installed(name, # pylint: disable=C0103
ri : False
Generate RI documentation for the gem(s).
pre_releases : False
Install pre-release version of gem(s) if available.
'''
ret = {'name': name, 'result': None, 'comment': '', 'changes': {}}
@ -106,7 +110,8 @@ def installed(name, # pylint: disable=C0103
runas=user,
version=version,
rdoc=rdoc,
ri=ri):
ri=ri,
pre_releases=pre_releases):
ret['result'] = True
ret['changes'][name] = 'Installed'
ret['comment'] = 'Gem was successfully installed'

View File

@ -29,8 +29,8 @@ class TestGemState(TestCase):
ret = gem.installed('quux')
self.assertEqual(True, ret['result'])
gem_install_succeeds.assert_called_once_with(
'quux', ruby=None, runas=None, version=None, rdoc=False,
ri=False
'quux', pre_releases=False, ruby=None, runas=None,
version=None, rdoc=False, ri=False
)
with patch.dict(gem.__salt__,
@ -38,8 +38,8 @@ class TestGemState(TestCase):
ret = gem.installed('quux')
self.assertEqual(False, ret['result'])
gem_install_fails.assert_called_once_with(
'quux', ruby=None, runas=None, version=None, rdoc=False,
ri=False
'quux', pre_releases=False, ruby=None, runas=None,
version=None, rdoc=False, ri=False
)
def test_removed(self):