def test_run_bundler_with_deployment_option(self): module = FakeAnsibleModule() module.run_command = Mock(return_value=(0, "", "")) module.params = { 'deployment': True } bundler = BundlerModule(module) bundler.get_bundle_path = Mock(return_value='/bin/bandler') bundler.run_bundle() module.run_command.assert_called_with('/bin/bandler install --without=deployment:test --deployment', check_rc=True)
def test_install_with_updated_gems(self): updated_output = """ 1 upgrade rails to 3.2.16 Using i18n (0.6.9)""" assert BundlerModule(None).gems_were_changed(updated_output) == True old_updated_output = """ Updating rails to 3.2.16 Using i18n (0.6.9)""" assert BundlerModule(None).gems_were_changed(old_updated_output) == True
def test_run_bundler_with_gemfile_option(self): module = FakeAnsibleModule() module.run_command = Mock(return_value=(0, "", "")) module.params = { 'gemfile': '/path/to/Gemfile' } bundler = BundlerModule(module) bundler.get_bundle_path = Mock(return_value='/bin/bandler') bundler.run_bundle() module.run_command.assert_called_with(['/bin/bandler', 'install', '--without=deployment:test', '--gemfile=/path/to/Gemfile'], check_rc=True)
def test_install_without_changes(self): existing_output = """Using rake (10.1.1) Using i18n (0.6.9)""" assert BundlerModule(None).gems_were_changed(existing_output) == False
def test_get_bundle_path_without_executable(self): module = FakeAnsibleModule() module.get_bin_path = Mock(return_value='/bin/bandler') bundler = BundlerModule(module) assert bundler.get_bundle_path() == '/bin/bandler'
def test_get_bundle_path_with_defined_executable_parameter(self): module = FakeAnsibleModule() module.params['executable'] = '/bin/bandler' bundler = BundlerModule(module) assert bundler.get_bundle_path() == '/bin/bandler'
def test_install_with_new_gems(self): install_output = """ Installing i18n (0.6.9)""" assert BundlerModule(None).gems_were_changed(install_output) == True