-
-
Save joestump/045969db1928537807d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(sprint.ly)Joes-MacBook-Air:rstudio-chef jstump$ bundle exec rake | |
/usr/local/Cellar/ruby/2.0.0-p353/bin/ruby -S rspec ./spec/server_spec.rb | |
chefspec | |
FF | |
Failures: | |
1) rstudio::server should install r-base | |
Failure/Error: expect(chef_run).to install_package('r-base') | |
expected "package[r-base] with" action :install to be in Chef run. Other package resources: | |
# ./spec/server_spec.rb:19:in `block (2 levels) in <top (required)>' | |
2) rstudio::server should install rstudio-server | |
Failure/Error: expect(chef_run).to install_package('rstudio-server') | |
NoMethodError: | |
undefined method `resource_collection' for nil:NilClass | |
# ./spec/server_spec.rb:23:in `block (2 levels) in <top (required)>' | |
Finished in 1.51 seconds | |
2 examples, 2 failures | |
Failed examples: | |
rspec ./spec/server_spec.rb:15 # rstudio::server should install r-base | |
rspec ./spec/server_spec.rb:22 # rstudio::server should install rstudio-server | |
/usr/local/Cellar/ruby/2.0.0-p353/bin/ruby -S rspec ./spec/server_spec.rb failed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts node["platform"] | |
# Set up the package repository. | |
case node["platform"].downcase | |
when "ubuntu", "debian" | |
include_recipe "apt" | |
apt_repository "rstudio-cran" do | |
uri node['rstudio']['apt']['uri'] | |
keyserver node['rstudio']['apt']['keyserver'] | |
key node['rstudio']['apt']['key'] | |
distribution "#{node['lsb']['codename']}/" | |
end | |
package "r-base" do | |
action :install | |
end | |
package "rstudio-server" do | |
action :install | |
end | |
end | |
service "rstudio-server" do | |
provider Chef::Provider::Service::Upstart | |
supports :start => true, :stop => true, :restart => true | |
action :start | |
end | |
template "/etc/rstudio/rserver.conf" do | |
source "etc/rstudio/rserver.conf.erb" | |
mode 0644 | |
owner "root" | |
group "root" | |
notifies :restart, resources(:service => "rstudio-server") | |
end | |
template "/etc/rstudio/rsession.conf" do | |
source "etc/rstudio/rsession.conf.erb" | |
mode 0644 | |
owner "root" | |
group "root" | |
notifies :restart, resources(:service => "rstudio-server") | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'spec_helper' | |
describe 'rstudio::server' do | |
let(:chef_run) do | |
# ChefSpec::Runner.new do |node| | |
# node.set['lsb']['codename'] = 'ubuntu' | |
# end.converge(described_recipe) | |
ChefSpec::Runner.new | |
end | |
before do | |
Fauxhai.mock(platform: 'ubuntu', version: '12.04') | |
end | |
it('should install r-base') do | |
# chef_run.node.set['cookbook']['attribute'] = 'hello' | |
chef_run.node.set['platform'] = 'ubuntu' | |
chef_run.converge(described_recipe) | |
expect(chef_run).to install_package('r-base') | |
end | |
it('should install rstudio-server') do | |
expect(chef_run).to install_package('rstudio-server') | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Set those attributes in the runner: