This repository has been archived by the owner on Aug 17, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlolcommits_test.rb
35 lines (30 loc) · 1.61 KB
/
lolcommits_test.rb
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
# -*- encoding : utf-8 -*-
require 'coveralls'
Coveralls.wear!
require 'minitest/autorun'
# Loads lolcommits directly from the lib folder so don't have to create
# a gem before testing
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'lolcommits'
include Lolcommits
class LolTest < MiniTest::Test
#
# issue #53, https://github.com/mroth/lolcommits/issues/53
# this will test the permissions but only locally, important before building a gem package!
#
def test_permissions
impact_perms = File.lstat(Lolcommits::Loltext::DEFAULT_FONT_PATH).mode & 0777
imagesnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'imagesnap', 'imagesnap')).mode & 0777
videosnap_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'videosnap', 'videosnap')).mode & 0777
commandcam_perms = File.lstat(File.join(Configuration::LOLCOMMITS_ROOT, 'vendor', 'ext', 'CommandCam', 'CommandCam.exe')).mode & 0777
assert impact_perms == 0644 || impact_perms == 0664,
"expected perms of 644/664 but instead got #{format '%o', impact_perms}"
assert imagesnap_perms == 0755 || imagesnap_perms == 0775,
"expected perms of 755/775 but instead got #{format '%o', imagesnap_perms}"
assert videosnap_perms == 0755 || videosnap_perms == 0775,
"expected perms of 755/775 but instead got #{format '%o', videosnap_perms}"
assert commandcam_perms == 0755 || commandcam_perms == 0775,
"expected perms of 755/775 but instead got #{format '%o', commandcam_perms}"
end
end