Skip to content

Commit

Permalink
Merge pull request #398 from cucumber/feature/fix-permissions-on-windows
Browse files Browse the repository at this point in the history
Set permissions to values which are supported on Windows. Closes #388.
  • Loading branch information
Dennis Günnewig committed May 10, 2016
2 parents 6c9a526 + 3e2cf52 commit 17ac24f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions doc/dependency_decisions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
---
- - :approve
- win32console
- :who:
:why:
:when: 2016-05-09 14:57:58.000000000 Z
- - :whitelist
- MIT
- :who:
Expand Down
8 changes: 4 additions & 4 deletions features/matchers/path/have_permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Check if path has permissions in filesystem
RSpec.describe 'Check if path has permissions', :type => :aruba do
let(:file) { 'file.txt' }
let(:permissions) { 0700 }
let(:permissions) { 0600 }
before(:each) { touch(file) }
before(:each) { chmod(permissions, file) }
Expand Down Expand Up @@ -67,7 +67,7 @@ Feature: Check if path has permissions in filesystem
RSpec.describe 'Check if path has permissions', :type => :aruba do
let(:files) { %w(file1.txt file2.txt) }
let(:permissions) { 0700 }
let(:permissions) { 0600 }
before :each do
files.each do |f|
Expand All @@ -89,7 +89,7 @@ Feature: Check if path has permissions in filesystem
RSpec.describe 'Check if path has permissions', :type => :aruba do
let(:files) { %w(file1.txt file2.txt) }
let(:permissions) { 0700 }
let(:permissions) { 0600 }
before :each do
touch(files.first)
Expand All @@ -109,7 +109,7 @@ Feature: Check if path has permissions in filesystem
RSpec.describe 'Check if path has permissions', :type => :aruba do
let(:path) { 'file.txt' }
let(:permissions) { 0777 }
let(:permissions) { 0700 }
it { expect(path).to have_permissions permissions }
end
Expand Down
14 changes: 7 additions & 7 deletions spec/aruba/api_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ def actual_permissions

let(:file_name) { @file_name }
let(:file_path) { @file_path }
let(:permissions) { '0655' }
let(:permissions) { '0644' }

before :each do
@aruba.set_environment_variable 'HOME', File.expand_path(@aruba.aruba.current_directory)
Expand All @@ -797,20 +797,20 @@ def actual_permissions

context 'when file exists' do
context 'and permissions are given as string' do
it { expect(actual_permissions).to eq('0655') }
it { expect(actual_permissions).to eq('0644') }
end

context 'and permissions are given as octal number' do
let(:permissions) { 0655 }
it { expect(actual_permissions).to eq('0655') }
let(:permissions) { 0644 }
it { expect(actual_permissions).to eq('0644') }
end

context 'and path has ~ in it' do
let(:path) { random_string }
let(:file_name) { File.join('~', path) }
let(:file_path) { File.join(@aruba.aruba.current_directory, path) }

it { expect(actual_permissions).to eq('0655') }
it { expect(actual_permissions).to eq('0644') }
end
end
end
Expand All @@ -819,7 +819,7 @@ def actual_permissions
let(:file_name) { @file_name }
let(:file_path) { @file_path }

let(:permissions) { '0655' }
let(:permissions) { '0644' }

before :each do
@aruba.set_environment_variable 'HOME', File.expand_path(@aruba.aruba.current_directory)
Expand Down Expand Up @@ -868,7 +868,7 @@ def actual_permissions
end

context 'and fails because the permissions are the same although they should be different' do
let(:different_permissions) { 0655 }
let(:different_permissions) { 0644 }

it { expect { @aruba.check_filesystem_permissions(different_permissions, file_name, false) }.to raise_error }
end
Expand Down

0 comments on commit 17ac24f

Please sign in to comment.