Skip to content

Commit

Permalink
Enable 80 character line limit on spec files
Browse files Browse the repository at this point in the history
  • Loading branch information
ncs-alane committed Feb 14, 2017
1 parent ff06d9e commit ce22f71
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ AllCops:
Metrics/AbcSize:
Max: 29
Metrics/LineLength:
Enabled: false
Include:
- spec/**/*.rb
Metrics/MethodLength:
Max: 40
Style/Documentation:
Expand Down
8 changes: 6 additions & 2 deletions spec/recipes/default_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,13 @@
node.normal['cpu']['0']['vendor_id'] = 'GenuineIntel'
node.normal['env']['extra_user_paths'] = []

paths = %w(/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin) + node['env']['extra_user_paths']
paths = %w(
/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin
) + node['env']['extra_user_paths']
paths.each do |folder|
stub_command("find #{folder} -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command(
"find #{folder} -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
end
end.converge(described_recipe)
end
Expand Down
32 changes: 20 additions & 12 deletions spec/recipes/minimize_access_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,24 @@

describe 'os-hardening::minimize_access' do
before do
stub_command("find /usr/local/sbin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command("find /usr/local/bin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command("find /usr/sbin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command("find /usr/bin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command("find /sbin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command("find /bin -perm -go+w -type f | wc -l | egrep '^0$'").and_return(false)
stub_command(
"find /usr/local/sbin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
stub_command(
"find /usr/local/bin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
stub_command(
"find /usr/sbin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
stub_command(
"find /usr/bin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
stub_command(
"find /sbin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
stub_command(
"find /bin -perm -go+w -type f | wc -l | egrep '^0$'"
).and_return(false)
end

cached(:chef_run) do
Expand All @@ -34,17 +46,13 @@
it 'remove write permission from /usr/local/sbin' do
is_expected.to run_execute(
'remove write permission from /usr/local/sbin'
).with(
command: 'chmod go-w -R /usr/local/sbin'
)
).with(command: 'chmod go-w -R /usr/local/sbin')
end

it 'remove write permission from /usr/local/bin' do
is_expected.to run_execute(
'remove write permission from /usr/local/bin'
).with(
command: 'chmod go-w -R /usr/local/bin'
)
).with(command: 'chmod go-w -R /usr/local/bin')
end

it 'remove write permission from /usr/sbin' do
Expand Down

0 comments on commit ce22f71

Please sign in to comment.