Accept mode as argument in `mkdir' action
This commit is contained in:
@@ -12,3 +12,17 @@ Feature: `mkdir' task action
|
||||
"""
|
||||
When I successfully execute the recipe
|
||||
Then the remote directory "some_directory" must exists
|
||||
|
||||
Scenario: creates directory with given permissions
|
||||
Given a recipe with:
|
||||
"""
|
||||
target 'some_host.test'
|
||||
|
||||
task :create_some_dir do
|
||||
mkdir '0700_directory', 0700
|
||||
mkdir '0500_directory', 0500
|
||||
end
|
||||
"""
|
||||
When I successfully execute the recipe
|
||||
Then the remote directory "0700_directory" must have 0700 mode
|
||||
And the remote directory "0500_directory" must have 0500 mode
|
||||
|
@@ -22,9 +22,16 @@ Then /^the remote file "([^"]+)" must contain exactly "([^"]+)"$/ do |path, cont
|
||||
check_exact_file_content path, content
|
||||
end
|
||||
|
||||
Then /^the remote file "([^"]+)" must have (\d+) mode$/ do |path, mode|
|
||||
def stat_mode(path)
|
||||
in_current_dir do
|
||||
puts path, ('%o' % [File::Stat.new(path).mode])[-4, 4], mode
|
||||
expect(('%o' % [File::Stat.new(path).mode])[-4, 4]).to match mode
|
||||
('%o' % [File::Stat.new(path).mode])[-4, 4]
|
||||
end
|
||||
end
|
||||
|
||||
Then /^the remote file "([^"]+)" must have (\d+) mode$/ do |path, mode|
|
||||
expect(stat_mode path).to eq mode
|
||||
end
|
||||
|
||||
Then /^the remote directory "([^"]+)" must have (\d+) mode$/ do |path, mode|
|
||||
expect(stat_mode path).to eq mode
|
||||
end
|
||||
|
Reference in New Issue
Block a user