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

Cookstyle Bot Auto Corrections with Cookstyle 7.13.0 #21

Open
wants to merge 1 commit 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
51 changes: 25 additions & 26 deletions files/default/tests/minitest/passenger_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,79 +4,78 @@ class PkgBuildSpec < MiniTest::Chef::Spec
describe_recipe 'pkg-build::passenger' do
let(:passenger_gem_deb) do
File.join(
node[:fpm_tng][:package_dir],
node['fpm_tng']['package_dir'],
"#{
[
node[:pkg_build][:pkg_prefix],
node['pkg_build']['pkg_prefix'],
'rubygem-passenger',
node[:pkg_build][:passenger][:version]
node['pkg_build']['passenger']['version'],
].compact.join('-')
}.deb"
)
end

let(:passenger_mod_deb) do
File.join(
node[:fpm_tng][:package_dir],
node['fpm_tng']['package_dir'],
"#{
[
node[:pkg_build][:pkg_prefix],
node['pkg_build']['pkg_prefix'],
'libapache2-mod-passenger',
node[:pkg_build][:passenger][:version]
node['pkg_build']['passenger']['version'],
].compact.join('-')
}.deb"
)
end

let(:gems_dir) do
@d ||= node[:languages][:ruby][:gems_dir]
@d ||= node['languages']['ruby']['gems_dir']
end

let(:passenger_root) do
@p ||= File.dirname(node[:languages][:ruby][:bin_dir])
@p ||= File.dirname(node['languages']['ruby']['bin_dir'])
end

let(:ruby_bin_dir) do
@r ||= node[:languages][:ruby][:bin_dir]
@r ||= node['languages']['ruby']['bin_dir']
end

let(:apache_conf_dir){ '/etc/apache2' }
let(:apache_conf_dir) { '/etc/apache2' }

it 'should create a custom passenger rubygem package' do
file(passenger_gem_deb).must_exist
end

it 'should create a custom passenger apache2 module package' do
file(passenger_mod_deb).must_exist
end

it 'should install module into ruby detected defined prefix and apache configurations into /etc/apache2' do
%x{dpkg-deb -c #{passenger_mod_deb}}.split("\n").delete_if{|full_line|
`dpkg-deb -c #{passenger_mod_deb}`.split("\n").delete_if do |full_line|
line = full_line.scan(%r{ \./.*$}).flatten.first.sub(' .', '')
full_line.start_with?('l') ||
line.start_with?(passenger_root) ||
passenger_root.start_with?(line) ||
line.start_with?(apache_conf_dir) ||
apache_conf_dir.start_with?(line)
}.must_be_empty
line.start_with?(passenger_root) ||
passenger_root.start_with?(line) ||
line.start_with?(apache_conf_dir) ||
apache_conf_dir.start_with?(line)
end.must_be_empty
end

it 'should install passenger gem into "system" gem directory' do
%x{dpkg-deb -c #{passenger_gem_deb}}.split("\n").delete_if{|full_line|
`dpkg-deb -c #{passenger_gem_deb}`.split("\n").delete_if do |full_line|
line = full_line.scan(%r{ \./.*$}).flatten.first.sub(' .', '')
full_line.start_with?('l') ||
line.start_with?(gems_dir) ||
gems_dir.start_with?(line) ||
line.start_with?(ruby_bin_dir) ||
ruby_bin_dir.start_with?(line)
}.must_be_empty
line.start_with?(gems_dir) ||
gems_dir.start_with?(line) ||
line.start_with?(ruby_bin_dir) ||
ruby_bin_dir.start_with?(line)
end.must_be_empty
end

it 'should have created modules in the apache2 module package' do
%x{dpkg-deb -c #{passenger_mod_deb}}.split("\n").detect{|line|
`dpkg-deb -c #{passenger_mod_deb}`.split("\n").detect do |line|
line.end_with?('.so')
}.wont_be_nil
end.wont_be_nil
end

end
end
20 changes: 10 additions & 10 deletions files/default/tests/minitest/ruby_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ class PkgBuildSpec < MiniTest::Chef::Spec
describe_recipe 'pkg-build::ruby' do
let(:ruby_deb) do
File.join(
node[:fpm_tng][:package_dir],
node['fpm_tng']['package_dir'],
"#{
[
node[:pkg_build][:pkg_prefix],
node['pkg_build']['pkg_prefix'],
'ruby',
node[:pkg_build][:ruby][:version],
node[:pkg_build][:ruby][:patchlevel],
node[:pkg_build][:ruby][:version],
node[:pkg_build][:ruby][:patchlevel]
node['pkg_build']['ruby']['version'],
node['pkg_build']['ruby']['patchlevel'],
node['pkg_build']['ruby']['version'],
node['pkg_build']['ruby']['patchlevel'],
].compact.join('-')
}.deb"
)
Expand All @@ -23,12 +23,12 @@ class PkgBuildSpec < MiniTest::Chef::Spec
end

it 'should install into defined path prefix' do
%x{dpkg-deb -c #{ruby_deb}}.split("\n").detect{|full_line|
`dpkg-deb -c #{ruby_deb}`.split("\n").detect do |full_line|
next if full_line.start_with?('l') # ignore links
line = full_line.scan(%r{ \./.*$}).flatten.first.sub(' .', '')
!line.start_with?(node[:pkg_build][:ruby][:install_prefix]) &&
!node[:pkg_build][:ruby][:install_prefix].start_with?(line)
}.must_be_nil
!line.start_with?(node['pkg_build']['ruby']['install_prefix']) &&
!node['pkg_build']['ruby']['install_prefix'].start_with?(line)
end.must_be_nil
end
end
end