Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

Commit

Permalink
Merge pull request #43 from scalp42/notify_statsd_dependencies
Browse files Browse the repository at this point in the history
only install StatsD dependencies when git updated
  • Loading branch information
mheffner committed Jul 20, 2015
2 parents 3cd4030 + 78d3b1e commit 54ce548
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion recipes/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
repository node['statsd']['repo']
revision node['statsd']['version']
action :sync
notifies :run, 'execute[install StatsD dependencies]', :immediately
end

execute 'install dependencies' do
execute 'install StatsD dependencies' do
command 'npm install -d'
cwd node['statsd']['path']
action :nothing
end
11 changes: 9 additions & 2 deletions spec/unit/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
cached(:upstart) do
chef_run.template('/etc/init/statsd.conf')
end
cached(:git) do
chef_run.git(node['statsd']['path'])
end

%w(nodejs git).each do |recipe|
it "includes the #{recipe} recipe" do
Expand All @@ -24,8 +27,12 @@
)
end

it 'installs statsd dependencies' do
expect(chef_run).to run_execute('npm install -d') \
it 'notifies to install statsd dependencies' do
expect(git).to notify('execute[install StatsD dependencies]').to(:run).immediately
end

it 'only installs statsd dependencies if git notified' do
expect(chef_run).to_not run_execute('npm install -d') \
.with(cwd: node['statsd']['path'])
end

Expand Down

0 comments on commit 54ce548

Please sign in to comment.