-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #277 from pocke/user-option-file
Make `send_file` aware of `user` option
- Loading branch information
Showing
7 changed files
with
305 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
describe file('/tmp/file_as_ordinary_user') do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
require 'spec_helper' | ||
|
||
describe file('/tmp/remote_file') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
|
||
describe file('/tmp/remote_file_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
|
||
%w[/tmp/remote_file_another_ordinary /tmp/remote_file_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello Itamae/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/file') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
|
||
describe file('/tmp/file_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
|
||
%w[/tmp/file_another_ordinary /tmp/file_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello World/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/template') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
|
||
describe file('/tmp/template_root') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
|
||
%w[/tmp/template_another_ordinary /tmp/template_another_ordinary_with_root].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/Hello/) } | ||
its(:content) { should match(/Good bye/) } | ||
its(:content) { should match(/^total memory: \d+kB$/) } | ||
its(:content) { should match(/^uninitialized node key: $/) } | ||
end | ||
end | ||
|
||
### | ||
|
||
describe file('/tmp/http_request.html') do | ||
it { should be_file } | ||
it { should be_owned_by "ordinary_san" } | ||
it { should be_grouped_into "ordinary_san" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
|
||
describe file('/tmp/http_request_root.html') do | ||
it { should be_file } | ||
it { should be_owned_by "root" } | ||
it { should be_grouped_into "root" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
|
||
%w[/tmp/http_request_another_ordinary.html /tmp/http_request_another_ordinary_with_root.html].each do |path| | ||
describe file(path) do | ||
it { should be_file } | ||
it { should be_owned_by "itamae" } | ||
it { should be_grouped_into "itamae" } | ||
its(:content) { should match(/"from":\s*"itamae"/) } | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
remote_file "/tmp/remote_file" do | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.txt" | ||
end | ||
|
||
remote_file "/tmp/remote_file_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.txt" | ||
end | ||
|
||
### | ||
|
||
file "/tmp/file" do | ||
content "Hello World" | ||
end | ||
|
||
file "/tmp/file_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
content 'Hello World' | ||
end | ||
|
||
file "/tmp/file_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
content 'Hello World' | ||
end | ||
|
||
file "/tmp/file_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
content 'Hello World' | ||
end | ||
|
||
### | ||
|
||
template "/tmp/template" do | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_root" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_another_ordinary" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
template "/tmp/template_another_ordinary_with_root" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
source "hello.erb" | ||
variables goodbye: "Good bye" | ||
end | ||
|
||
### | ||
|
||
http_request "/tmp/http_request.html" do | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_root.html" do | ||
user 'root' | ||
owner 'root' | ||
group 'root' | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_another_ordinary.html" do | ||
user 'itamae' | ||
owner 'itamae' | ||
group 'itamae' | ||
url "https://httpbin.org/get?from=itamae" | ||
end | ||
|
||
http_request "/tmp/http_request_another_ordinary_with_root.html" do | ||
user 'root' | ||
owner 'itamae' | ||
group 'itamae' | ||
url "https://httpbin.org/get?from=itamae" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters