Class: Stringup::FileAssertion

Inherits:
Assertion show all
Defined in:
lib/stringup/assertions/file_assertion.rb

Direct Known Subclasses

CreatesFileAssertion, RemovesFileAssertion

Instance Method Summary collapse

Methods inherited from Assertion

[], assertion, #describe_should_at, each, registry

Constructor Details

#initialize(path, options = {}) ⇒ FileAssertion

Returns a new instance of FileAssertion.



4
5
6
7
# File 'lib/stringup/assertions/file_assertion.rb', line 4

def initialize(path, options = {})
  @path = path
  @options = options
end

Instance Method Details

#kindObject



9
10
11
12
13
14
15
# File 'lib/stringup/assertions/file_assertion.rb', line 9

def kind
  if @options[:directory]
    :directory
  elsif @options[:file]
    :file
  end
end

#kind_nameObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/stringup/assertions/file_assertion.rb', line 17

def kind_name
  case kind
  when :file
    'a regular file'
  when :directory
    'a directory'
  else
    'a file'
  end
end