Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to specify which version of the gem to install. #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
default.remote_syslog.version = nil # Latest version is installed if nil.
default.remote_syslog.init_style = "init"
default.remote_syslog.conf.files = ["/var/log/*.*"]
default.remote_syslog.destination.host = "logs.papertrailapp.com"
Expand Down
5 changes: 4 additions & 1 deletion recipes/gem.rb
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
gem_package "remote_syslog"
gem_package "remote_syslog" do
version node.remote_syslog.version
action :upgrade
end
13 changes: 11 additions & 2 deletions spec/gem_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
require 'chefspec'

describe 'remote_syslog::gem ' do
let (:chef_run) { ChefSpec::ChefRunner.new.converge 'remote_syslog::gem' }
let (:chef_run) { ChefSpec::ChefRunner.new }

it 'should install the gem' do
chef_run.converge 'remote_syslog::gem'

it 'should do something' do
chef_run.should install_gem_package 'remote_syslog'
end

it 'should install the gem with the specified version' do
chef_run.node.set['remote_syslog']['version'] = '1.6.7.2'
chef_run.converge 'remote_syslog::gem'

chef_run.should install_gem_package_at_version 'remote_syslog', '1.6.7.2'
end
end