File: file_spec.rb

package info (click to toggle)
ruby-specinfra 2.94.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,448 kB
  • sloc: ruby: 10,538; sh: 4; makefile: 4
file content (135 lines) | stat: -rw-r--r-- 3,646 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
require 'spec_helper'

set :os, { :family => nil }

describe get_command(:check_file_is_directory, '/tmp') do
  it { should eq 'test -d /tmp' }
end

describe get_command(:check_file_is_symlink, '/tmp') do
  it { should eq 'test -L /tmp' }
end

describe get_command(:change_file_mode, '/tmp', '0644') do
  it { should eq 'chmod 0644 /tmp' }
end

describe get_command(:change_file_mode, '/tmp', '0644', :recursive => true) do
  it { should eq 'chmod -R 0644 /tmp' }
end

describe get_command(:change_file_owner, '/tmp', 'root') do
  it { should eq 'chown root /tmp' }
end

describe get_command(:change_file_owner, '/tmp', 'root', 'root') do
  it { should eq 'chown root:root /tmp' }
end

describe get_command(:change_file_owner, '/tmp', 'root', 'Domain Users') do
  it { should eq 'chown root:Domain\\ Users /tmp' }
end

describe get_command(:change_file_owner, '/tmp', 'root', 'root', :recursive => true) do
  it { should eq 'chown -R root:root /tmp' }
end

describe get_command(:change_file_group, '/tmp', 'root') do
  it { should eq 'chgrp root /tmp' }
end

describe get_command(:change_file_group, '/tmp', 'Domain Users') do
  it { should eq 'chgrp Domain\ Users /tmp' }
end

describe get_command(:change_file_group, '/tmp', 'root', :recursive => true) do
  it { should eq 'chgrp -R root /tmp' }
end

describe get_command(:create_file_as_directory, '/tmp') do
  it { should eq 'mkdir -p /tmp' }
end

describe get_command(:get_file_owner_user, '/tmp') do
  it { should eq 'stat -c %U /tmp' }
end

describe get_command(:get_file_owner_group, '/tmp') do
  it { should eq 'stat -c %G /tmp' }
end

describe get_command(:copy_file, '/src', '/dest') do
  it { should eq 'cp -p /src /dest' }
end

describe get_command(:copy_file, '/src', '/dest', :recursive => true) do
  it { should eq 'cp -pR /src /dest' }
end

describe get_command(:move_file, '/src', '/dest') do
  it { should eq 'mv /src /dest' }
end

describe get_command(:link_file_to, '/link', '/target') do
  it { should eq 'ln -s /target /link' }
end

describe get_command(:link_file_to, '/link', '/target', :force => true) do
  it { should eq 'ln -sf /target /link' }
end

describe get_command(:link_file_to, '/link', '/target', :no_dereference => true) do
  it { should eq 'ln -sn /target /link' }
end

describe get_command(:link_file_to, '/link', '/target', :force => true, :no_dereference => true) do
  it { should eq 'ln -sfn /target /link' }
end

describe get_command(:remove_file, '/tmp') do
  it { should eq 'rm -rf /tmp' }
end

describe get_command(:check_file_is_link, '/tmp') do
  it { should eq 'test -L /tmp' }
end

describe get_command(:check_file_is_pipe, '/tmp') do
  it { should eq 'test -p /tmp' }
end

describe get_command(:check_file_is_block_device, '/tmp') do
  it { should eq 'test -b /tmp' }
end

describe get_command(:check_file_is_character_device, '/tmp') do
  it { should eq 'test -c /tmp' }
end

describe get_command(:get_file_link_target, '/tmp') do
  it { should eq 'readlink /tmp' }
end

describe get_command(:get_file_link_realpath, '/tmp') do
  it { should eq 'readlink -e /tmp' }
end

describe get_command(:check_file_is_dereferenceable, '/tmp') do
  it { should eq 'test -n "$(readlink -e /tmp)"' }
end

describe get_command(:check_file_exists, '/tmp') do
  it { should eq 'test -e /tmp' }
end

describe get_command(:get_file_mtime, '/tmp') do
  it { should eq 'stat -c %Y /tmp' }
end

describe get_command(:get_file_size, '/tmp') do
  it { should eq 'stat -c %s /tmp' }
end

describe get_command(:download_file, 'http://example.com/sample_file', '/tmp/sample_file') do
  it { should eq 'curl -sSL http://example.com/sample_file -o /tmp/sample_file' }
end