Permalink
Browse files

fixing style issues for travis

  • Loading branch information...
1 parent d076dcb commit e3f5f12f9298d1f017e5be78659c16821ee400c4 @someara someara committed Dec 12, 2013
Showing with 236 additions and 228 deletions.
  1. +12 −10 .rubocop.yml
  2. +1 −1 .travis.yml
  3. +3 −3 Gemfile
  4. +4 −2 files/default/tests/minitest/mod_ssl_test.rb
  5. +0 −1 files/default/tests/minitest/support/helpers.rb
  6. +2 −0 spec/spec_helper.rb
  7. +4 −4 test/features/step_definitions/webserver_steps.rb
  8. +2 −2 test/features/support/svn_helpers.rb
  9. +9 −8 test/features/support/web_helpers.rb
  10. +8 −7 test/kitchen/cookbooks/apache2_test/files/default/tests/minitest/support/helpers.rb
  11. +70 −70 test/kitchen/cookbooks/apache2_test/metadata.rb
  12. +4 −4 test/kitchen/cookbooks/apache2_test/recipes/basic_web_app.rb
  13. +1 −1 test/kitchen/cookbooks/apache2_test/recipes/default.rb
  14. +1 −1 test/kitchen/cookbooks/apache2_test/recipes/god_monitor.rb
  15. +5 −5 test/kitchen/cookbooks/apache2_test/recipes/mod_auth_basic.rb
  16. +5 −5 test/kitchen/cookbooks/apache2_test/recipes/mod_auth_digest.rb
  17. +4 −4 test/kitchen/cookbooks/apache2_test/recipes/mod_auth_openid.rb
  18. +12 −12 test/kitchen/cookbooks/apache2_test/recipes/mod_authnz_ldap.rb
  19. +5 −5 test/kitchen/cookbooks/apache2_test/recipes/mod_authz_groupfile.rb
  20. +4 −4 test/kitchen/cookbooks/apache2_test/recipes/mod_authz_listed_host.rb
  21. +4 −4 test/kitchen/cookbooks/apache2_test/recipes/mod_authz_unlisted_host.rb
  22. +5 −5 test/kitchen/cookbooks/apache2_test/recipes/mod_authz_user.rb
  23. +3 −3 test/kitchen/cookbooks/apache2_test/recipes/mod_cgi.rb
  24. +7 −7 test/kitchen/cookbooks/apache2_test/recipes/mod_dav_svn.rb
  25. +4 −4 test/kitchen/cookbooks/apache2_test/recipes/mod_expires.rb
  26. +10 −10 test/kitchen/cookbooks/apache2_test/recipes/mod_perl.rb
  27. +7 −7 test/kitchen/cookbooks/apache2_test/recipes/mod_php5.rb
  28. +12 −11 test/kitchen/cookbooks/apache2_test/recipes/mod_proxy_ajp.rb
  29. +7 −7 test/kitchen/cookbooks/apache2_test/recipes/mod_python.rb
  30. +6 −6 test/kitchen/cookbooks/apache2_test/recipes/mod_ssl.rb
  31. +3 −3 test/kitchen/cookbooks/apache2_test/recipes/mod_status_remote.rb
  32. +1 −1 test/kitchen/cookbooks/apache2_test/recipes/modules.rb
  33. +11 −11 test/kitchen/cookbooks/apache2_test/recipes/setup.rb
View
@@ -1,15 +1,17 @@
-AllCops:
- Excludes:
- - test/**
- - vendor/**
-
-AlignParameters:
- Enabled: false
Encoding:
Enabled: false
-HashSyntax:
- Enabled: false
+
LineLength:
+ Max: 300
+
+HashSyntax:
+ EnforcedStyle: hash_rockets
+
+IfUnlessModifier:
Enabled: false
+
MethodLength:
- Max: 30
+ Max: 11
+
+TrivialAccessors:
+ ExactNameMatch: true
View
@@ -5,5 +5,5 @@ before_script:
- bundle exec berks install
script:
- bundle exec foodcritic -f any . --tags ~FC007 --tags ~FC015 --tags ~FC023
- # - bundle exec rspec --color --format progress
+ - bundle exec rspec --color --format progress
- bundle exec rubocop
View
@@ -13,11 +13,11 @@
source 'https://rubygems.org'
gem 'berkshelf', '~> 2.0'
-gem 'chefspec', '~> 2.0'
+gem 'chefspec', '~> 3.0'
gem 'foodcritic', '~> 3.0'
-gem 'rubocop', '~> 0.12'
+gem 'rubocop', '~> 0.14'
group :integration do
- gem 'test-kitchen', '~> 1.0.0.beta'
+ gem 'test-kitchen', '~> 1.0'
gem 'kitchen-vagrant', '~> 0.11'
end
@@ -21,7 +21,9 @@
end
it 'configures SSLCiphersuit from an attribute' do
- assert_match(/^SSLCipherSuite #{node['apache']['mod_ssl']['cipher_suite']}$/,
- File.read("#{node['apache']['dir']}/mods-enabled/ssl.conf"))
+ assert_match(
+ /^SSLCipherSuite #{node['apache']['mod_ssl']['cipher_suite']}$/,
+ File.read("#{node['apache']['dir']}/mods-enabled/ssl.conf")
+ )
end
end
@@ -61,6 +61,5 @@ def ran_recipe?(recipe)
end
recipes.include?(recipe)
end
-
end
end
View
@@ -0,0 +1,2 @@
+require 'chefspec'
+require 'chefspec/berkshelf'
@@ -48,10 +48,10 @@
When /^the authenticated user is (not )?listed (?:in the directory )(?:in the file|as authorized)$/ do |not_listed|
http_request '/secure/',
- :basic_auth => {
- :username => not_listed ? 'meatballs' : 'bork',
- :password => 'secret'
- }
+ :basic_auth => {
+ :username => not_listed ? 'meatballs' : 'bork',
+ :password => 'secret'
+ }
end
When 'the browser requests a page specifying that it does not support compression' do
@@ -2,11 +2,11 @@
def run(cmd)
%x{#{cmd}}
- assert $?.success?
+ assert $CHILD_STATUS.success?
end
def svn_commit_new_file(filename, content)
- File.open(filename, 'w') {|f| f.write(content) }
+ File.open(filename, 'w') { |f| f.write(content) }
run "svn add #{filename} && svn commit -m 'Committed a change.'"
end
@@ -27,19 +27,19 @@ def compresses_response?(request_type)
def default_page_present?(body)
['This is the default web page for this server.',
- 'Apache HTTP Server Test Page'].any?{|msg| body.include? msg}
+ 'Apache HTTP Server Test Page'].any? { |msg| body.include? msg }
end
# Filenames in a directory listing response
def dir_listing_entries
- Nokogiri::HTML(http_response.body).xpath("//td/a/text()").map{|a| a.to_s}
+ Nokogiri::HTML(http_response.body).xpath('//td/a/text()').map { |a| a.to_s }
end
def environment_variables(response_body)
- Hash[response_body.split("\n").map{|v| v.split('=')}]
+ Hash[response_body.split("\n").map { |v| v.split('=') }]
end
-def http_request(path, options={})
+def http_request(path, options = {})
if options.key?(:digest_auth)
# HTTParty digest doesn't appear to work
@response = http_request_digest_curl(path, options)
@@ -52,13 +52,14 @@ def http_request(path, options={})
def http_request_digest_curl(path, options)
credentials = "#{options[:digest_auth][:username]}:#{options[:digest_auth][:password]}"
curl_response = %x{curl -s -i --digest -u #{credentials} http://#{test_host}:#{http_port}#{path}}
- assert $?.success?
+ assert $CHILD_STATUS.success?
@response = Class.new do
def initialize(response)
@curl_response = response
end
+
def code
- @curl_response.scan(%r{HTTP/1.1 ([0-9]+)}).flatten.last.to_i
+ @curl_response.scan(/HTTP\/1.1 ([0-9]+)/).flatten.last.to_i
end
end.new(curl_response)
end
@@ -73,7 +74,7 @@ def http_response
def http_response_version(user_agent, protocol_version)
response_line = %x{curl -s #{'-0 ' if protocol_version == '1.0'} -i -A '#{user_agent}' 'http://#{test_host}/' | head -n1}
- assert $?.success?
+ assert $CHILD_STATUS.success?
response_line.scan(/HTTP\/([0-9]+\.[0-9]+) [0-9]+.*/).flatten.first
end
@@ -82,5 +83,5 @@ def max_age_seconds(http_headers)
end
def request_parameters(response_body)
- Hash[*Nokogiri::HTML(response_body).xpath("//td/text()").map{|h| h.to_s.strip.sub(/:$/, '')}]
+ Hash[*Nokogiri::HTML(response_body).xpath('//td/text()').map { |h| h.to_s.strip.sub(/:$/, '') }]
end
@@ -1,4 +1,5 @@
module Helpers
+ # top-level module documentation comment.
module Apache
require 'chef/mixin/shell_out'
include Chef::Mixin::ShellOut
@@ -13,7 +14,7 @@ def apache_config_parses?
def apache_configured_ports
port_config = File.read("#{node['apache']['dir']}/ports.conf")
- port_config.scan(/^Listen ([0-9]+)/).flatten.map{|p| p.to_i}
+ port_config.scan(/^Listen ([0-9]+)/).flatten.map { |p| p.to_i }
end
def apache_enabled_modules
@@ -24,21 +25,21 @@ def apache_enabled_modules
else
:stdout
end
- ).split.select! {|i| i =~ /_module$/}
+ ).split.select! { |i| i =~ /_module$/ }
end
def apache_service
service(case node['platform']
- when "debian","ubuntu" then "apache2"
- when "freebsd" then "apache22"
- else "httpd"
+ when 'debian', 'ubuntu' then 'apache2'
+ when 'freebsd' then 'apache22'
+ else 'httpd'
end)
end
def config
file(case node['platform']
- when "debian","ubuntu" then "#{node['apache']['dir']}/apache2.conf"
- when "freebsd" then "#{node['apache']['dir']}/httpd.conf"
+ when 'debian', 'ubuntu' then "#{node['apache']['dir']}/apache2.conf"
+ when 'freebsd' then "#{node['apache']['dir']}/httpd.conf"
else "#{node['apache']['dir']}/conf/httpd.conf"
end)
end
@@ -1,88 +1,88 @@
-maintainer "Andrew Crump"
-maintainer_email "andrew@kotirisoftware.com"
-license "Apache 2.0"
-description "Acceptance tests for apache2"
+maintainer 'Andrew Crump'
+maintainer_email 'andrew@kotirisoftware.com'
+license 'Apache 2.0'
+description 'Acceptance tests for apache2'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.1.0"
+version '0.1.0'
-depends "apache2"
-depends "jpackage"
-depends "openldap"
-depends "tomcat"
-depends "yum", '< 3.0'
+depends 'apache2'
+depends 'jpackage'
+depends 'openldap'
+depends 'tomcat'
+depends 'yum', '< 3.0'
-recipe "apache2_test::default", "Test example for default recipe"
-recipe "apache2_test::mod_auth_basic", "Test example for basic authentication"
-recipe "apache2_test::mod_auth_digest", "Test example for digest authentication"
-recipe "apache2_test::mod_auth_openid", "Test example for openid authentication"
-recipe "apache2_test::mod_authnz_ldap", "Test example for LDAP authentication"
-recipe "apache2_test::mod_authz_groupfile", "Test example for group file authorization"
-recipe "apache2_test::mod_authz_listed_host", "Test example for host-based authorization"
-recipe "apache2_test::mod_authz_unlisted_host", "Test example for hosted-based authorization"
-recipe "apache2_test::mod_authz_user", "Test example for named user authorization"
-recipe "apache2_test::mod_cgi", "Test example for hosting a CGI script"
-recipe "apache2_test::mod_expires", "Test example for setting cache expiry headers"
-recipe "apache2_test::mod_dav_svn", "Test example for Subversion repository hosting"
-recipe "apache2_test::mod_perl", "Test example for hosting a Perl application"
-recipe "apache2_test::mod_proxy_ajp", "Test example for proxying requests to a Java application"
-recipe "apache2_test::mod_php5", "Test example for hosting a PHP application"
-recipe "apache2_test::mod_python", "Test example for hosting a Python application"
-recipe "apache2_test::mod_ssl", "Test example for SSL"
-recipe "apache2_test::mod_status_remote", "Test example for viewing server status"
+recipe 'apache2_test::default', 'Test example for default recipe'
+recipe 'apache2_test::mod_auth_basic', 'Test example for basic authentication'
+recipe 'apache2_test::mod_auth_digest', 'Test example for digest authentication'
+recipe 'apache2_test::mod_auth_openid', 'Test example for openid authentication'
+recipe 'apache2_test::mod_authnz_ldap', 'Test example for LDAP authentication'
+recipe 'apache2_test::mod_authz_groupfile', 'Test example for group file authorization'
+recipe 'apache2_test::mod_authz_listed_host', 'Test example for host-based authorization'
+recipe 'apache2_test::mod_authz_unlisted_host', 'Test example for hosted-based authorization'
+recipe 'apache2_test::mod_authz_user', 'Test example for named user authorization'
+recipe 'apache2_test::mod_cgi', 'Test example for hosting a CGI script'
+recipe 'apache2_test::mod_expires', 'Test example for setting cache expiry headers'
+recipe 'apache2_test::mod_dav_svn', 'Test example for Subversion repository hosting'
+recipe 'apache2_test::mod_perl', 'Test example for hosting a Perl application'
+recipe 'apache2_test::mod_proxy_ajp', 'Test example for proxying requests to a Java application'
+recipe 'apache2_test::mod_php5', 'Test example for hosting a PHP application'
+recipe 'apache2_test::mod_python', 'Test example for hosting a Python application'
+recipe 'apache2_test::mod_ssl', 'Test example for SSL'
+recipe 'apache2_test::mod_status_remote', 'Test example for viewing server status'
%w{centos ubuntu}.each do |os|
supports os
end
-attribute "apache_test/auth_username",
- :display_name => "Test Username",
- :description => "Username for the test user",
- :default => "bork"
+attribute 'apache_test/auth_username',
+ :display_name => 'Test Username',
+ :description => 'Username for the test user',
+ :default => 'bork'
-attribute "apache_test/auth_password",
- :display_name => "Test Password",
- :description => "Password for the test user",
- :default => "secret"
+attribute 'apache_test/auth_password',
+ :display_name => 'Test Password',
+ :description => 'Password for the test user',
+ :default => 'secret'
-attribute "apache_test/cache_expiry_seconds",
- :display_name => "Cache Expiry (Seconds)",
- :description => "The expiry time to set in caching response headers",
- :default => "60"
+attribute 'apache_test/cache_expiry_seconds',
+ :display_name => 'Cache Expiry (Seconds)',
+ :description => 'The expiry time to set in caching response headers',
+ :default => '60'
-attribute "apache_test/app_dir",
- :display_name => "Application Directory",
- :description => "Parent directory to deploy test applications under",
- :default => "/home/apache2/env"
+attribute 'apache_test/app_dir',
+ :display_name => 'Application Directory',
+ :description => 'Parent directory to deploy test applications under',
+ :default => '/home/apache2/env'
-attribute "apache_test/cgi_dir",
- :display_name => "CGI Directory",
- :description => "Directory to install CGI scripts into",
- :default => "/usr/lib/cgi-bin"
+attribute 'apache_test/cgi_dir',
+ :display_name => 'CGI Directory',
+ :description => 'Directory to install CGI scripts into',
+ :default => '/usr/lib/cgi-bin'
-attribute "apache_test/root_dir",
- :display_name => "Root Directory",
- :description => "Webserver document root directory",
- :default => "/var/www"
+attribute 'apache_test/root_dir',
+ :display_name => 'Root Directory',
+ :description => 'Webserver document root directory',
+ :default => '/var/www'
-attribute "apache_test/remote_host_ip",
- :display_name => "Remote Host IP",
- :description => "IP Address to allow requests from",
- :default => "192.168"
+attribute 'apache_test/remote_host_ip',
+ :display_name => 'Remote Host IP',
+ :description => 'IP Address to allow requests from',
+ :default => '192.168'
-attribute "apache_test/ssl_dir",
- :display_name => "SSL Directory",
- :description => "Directory for SSL certificates",
- :default => "/home/apache2"
+attribute 'apache_test/ssl_dir',
+ :display_name => 'SSL Directory',
+ :description => 'Directory for SSL certificates',
+ :default => '/home/apache2'
-attribute "apache_test/ssl_cert_file",
- :display_name => "SSL Certificate Path",
- :description => "File path for the generated self-signed certificate"
+attribute 'apache_test/ssl_cert_file',
+ :display_name => 'SSL Certificate Path',
+ :description => 'File path for the generated self-signed certificate'
-attribute "apache_test/ssl_cert_key_file",
- :display_name => "SSL Certificate Private Key",
- :description => "File path for the generated private key"
+attribute 'apache_test/ssl_cert_key_file',
+ :display_name => 'SSL Certificate Private Key',
+ :description => 'File path for the generated private key'
-attribute "apache_test/svn_dir",
- :display_name => "Subversion Directory",
- :description => "File path for test Subversion repository",
- :default => "/home/apache2/svn"
+attribute 'apache_test/svn_dir',
+ :display_name => 'Subversion Directory',
+ :description => 'File path for test Subversion repository',
+ :default => '/home/apache2/svn'
@@ -17,7 +17,7 @@
# limitations under the License.
#
-include_recipe "apache2::default"
+include_recipe 'apache2::default'
app_dir = "#{node['apache_test']['root_dir']}/basic_web_app"
@@ -26,12 +26,12 @@
end
file "#{app_dir}/index.html" do
- content "Hello World"
+ content 'Hello World'
action :create
end
-web_app "basic_webapp" do
- cookbook "apache2"
+web_app 'basic_webapp' do
+ cookbook 'apache2'
server_name node['hostname']
server_aliases [node['fqdn']]
docroot app_dir
@@ -17,4 +17,4 @@
# limitations under the License.
#
-include_recipe "apache2::default"
+include_recipe 'apache2::default'
@@ -16,4 +16,4 @@
# limitations under the License.
#
-include_recipe "apache2::god_monitor"
+include_recipe 'apache2::god_monitor'
Oops, something went wrong.

0 comments on commit e3f5f12

Please sign in to comment.