Class: Stringup::RemovesFileAssertion
Instance Method Summary
collapse
#initialize, #kind, #kind_name
Methods inherited from Assertion
[], assertion, each, registry
Instance Method Details
#after(test_case) ⇒ Object
5
6
7
|
# File 'lib/stringup/assertions/removes_file_assertion.rb', line 5
def after(test_case)
test_case.assert !File.exist?(@path), "File still exists at #{@path}"
end
|
#before(test_case) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/stringup/assertions/removes_file_assertion.rb', line 9
def before(test_case)
test_case.assert File.exist?(@path), "File does not exist at #{@path}"
case kind
when :file
test_case.assert File.file?(@path), "File to remove at #{@path} is not a regular file"
when :directory
test_case.assert File.file?(@path), "File to remove at #{@path} is not a directory"
end
end
|
#describe_should_at(event) ⇒ Object
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/stringup/assertions/removes_file_assertion.rb', line 19
def describe_should_at(event)
case event
when :after
"have removed #{kind_name} at `#{@path}`"
when :before
"find #{kind_name} at `#{@path}` to remove"
else
super
end
end
|