Skip to content

Commit

Permalink
Restructure tests in order to test packages separately
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandoaleman committed Oct 16, 2018
1 parent 90ba4b6 commit cd4179e
Show file tree
Hide file tree
Showing 10 changed files with 3 additions and 140 deletions.
6 changes: 1 addition & 5 deletions .kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ suites:
- recipe[test::asdf_script]
- recipe[test::asdf_plugin]
- recipe[test::asdf_package]
- name: ruby
run_list:
- recipe[test::vagrant]
- recipe[test::ruby]
verifier:
inspec_tests:
- test/smoke/ruby
- test/smoke/default/asdf_test.rb
8 changes: 1 addition & 7 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,4 @@ suites:
- recipe[test::asdf_package]
verifier:
inspec_tests:
- test/smoke/default
- name: ruby
run_list:
- recipe[test::ruby]
verifier:
inspec_tests:
- test/smoke/ruby
- test/smoke/default/asdf_test.rb
8 changes: 0 additions & 8 deletions spec/unit/resources/asdf_package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@
end

context "using #{platform} #{version}" do
it 'installs nodejs package' do
expect(chef_run).to install_asdf_package('nodejs')
end

it 'installs ruby package' do
expect(chef_run).to install_asdf_package('ruby')
end

it 'installs php package' do
expect(chef_run).to install_asdf_package('php')
end
end
end
end
Expand Down
16 changes: 0 additions & 16 deletions test/cookbooks/test/recipes/asdf_package.rb
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# frozen_string_literal: true

apt_update 'update'

asdf_package 'nodejs' do
user 'vagrant'
version '10.12.0'
live_stream true
action [:install, :global]
end

asdf_package 'ruby' do
user 'vagrant'
version '2.5.1'
live_stream true
action [:install, :global]
end

asdf_package 'php' do
user 'vagrant'
version '7.2.11'
live_stream true
action [:install, :global]
end
2 changes: 0 additions & 2 deletions test/cookbooks/test/recipes/asdf_plugin.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

apt_update 'update'

asdf_plugin 'clojure' do
user 'vagrant'
end
Expand Down
2 changes: 0 additions & 2 deletions test/cookbooks/test/recipes/asdf_script.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# frozen_string_literal: true

apt_update 'update'

asdf_script 'asdf version' do
user 'vagrant'
code %(asdf current)
Expand Down
2 changes: 1 addition & 1 deletion test/cookbooks/test/recipes/asdf_user_install.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

apt_update 'update'
apt_update

asdf_user_install 'vagrant'
35 changes: 0 additions & 35 deletions test/cookbooks/test/recipes/ruby.rb

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,6 @@
control 'asdf_package' do
title 'Installs, uninstalls and sets global asdf packages'

desc 'Installs nodejs 10.12.0'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list nodejs"') do
its('stdout') { should include('10.12.0') }
its('exit_status') { should eq 0 }
end

desc 'Sets nodejs 10.12.0 to global'
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('nodejs 10.12.0') }
end

desc 'Installs ruby 2.5.1'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list ruby"') do
its('stdout') { should include('2.5.1') }
Expand All @@ -93,15 +82,4 @@
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('ruby 2.5.1') }
end

desc 'Installs php 7.2.11'
describe bash('sudo -H -u vagrant bash -c "source /etc/profile.d/asdf.sh && asdf list php"') do
its('stdout') { should include('7.2.11') }
its('exit_status') { should eq 0 }
end

desc 'Sets php 7.2.11 to global'
describe file('/home/vagrant/.tool-versions') do
its('content') { should include('php 7.2.11') }
end
end
42 changes: 0 additions & 42 deletions test/smoke/ruby/default_test.rb

This file was deleted.

0 comments on commit cd4179e

Please sign in to comment.