Skip to content

Commit

Permalink
Add checks for block_device and character device
Browse files Browse the repository at this point in the history
  • Loading branch information
Bert Hajee authored and Bert Hajee committed Jun 10, 2015
1 parent 32ae49f commit 0708c5b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
8 changes: 8 additions & 0 deletions lib/serverspec/type/file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ def file?
@runner.check_file_is_file(@name)
end

def block_device?
@runner.check_file_is_block_device(@name)
end

def character_device?
@runner.check_file_is_character_device(@name)
end

def socket?
@runner.check_file_is_socket(@name)
end
Expand Down
2 changes: 1 addition & 1 deletion serverspec.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "rspec", "~> 3.0"
spec.add_runtime_dependency "rspec-its"
spec.add_runtime_dependency "multi_json"
spec.add_runtime_dependency "specinfra", "~> 2.32"
spec.add_runtime_dependency "specinfra", "~> 2.35"
spec.add_development_dependency "bundler", "~> 1.3"
spec.add_development_dependency "rake", "~> 10.1.1"
end
8 changes: 8 additions & 0 deletions spec/type/base/file_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
it { should be_socket }
end

describe file('/dev/disk0') do
it { should be_block_device }
end

describe file('/dev/ttys0') do
it { should be_character_device }
end

describe file('/var/run/pure-ftpd/pure-ftpd.upload.pipe') do
it { should be_pipe }
end
Expand Down

0 comments on commit 0708c5b

Please sign in to comment.