Class: Spex::ChangedOwnerCheck
Instance Attribute Summary
Attributes inherited from Check
#options, #target
Instance Method Summary
collapse
Methods inherited from FileCheck
#kind, #kind_name
Methods inherited from Check
[], #active?, as, each, example, examples, #initialize, option, options, #prepare, registry, #validate!
Constructor Details
This class inherits a constructor from Spex::Check
Instance Method Details
#after ⇒ Object
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/spex/checks/changed_owner_check.rb', line 26
def after
current = current_username
if to_username
assert File.exist?(target), "File does not exist at #{target}"
assert_equal to_username, current
elsif active?
assert_not_equal @before_username, current, "Owner is still '#{@before_username}'"
elsif !active?
assert_equal @before_username, current, "Owner was changed from '#{@before_username}' to '#{current}'"
end
end
|
#before ⇒ Object
16
17
18
19
20
21
22
23
24
|
# File 'lib/spex/checks/changed_owner_check.rb', line 16
def before
assert File.exist?(target), "File does not exist at #{target}"
if from_username
assert_equal from_username, current_username, "File is not owned by '#{from_username}'"
elsif to_username
assert_not_equal to_username, current_username, "Owner will not be changed; already '#{to_username}'"
end
@before_username = current_username
end
|
#to_s ⇒ Object
38
39
40
|
# File 'lib/spex/checks/changed_owner_check.rb', line 38
def to_s
[super, detail].join(' ')
end
|