Sha256: 24c6c515f60370438c08aa5b9feebda25dd7c527eda2486f02298628861a0a13
Contents?: true
Size: 952 Bytes
Versions: 1
Compression:
Stored size: 952 Bytes
Contents
module RSpec::FileMatchers class HaveFileItem attr_accessor :location def initialize(*args) self.location = get_location(args).to_s end def get_location(*args) args = args.flatten loc = if args.size > 1 dir, name = *args File.join(dir.to_s, name.to_s) else args[0].to_s end end def matches? x=nil, &block puts location.inspect match = File.send :"#{artifact}?", location yield if block && match match end def artifact raise "artifact method must be overridden by subclass" end def failure_message "Expected #{artifact} at: #{location} to exist, but it did not" end def negative_failure_message "Did not expected #{artifact} at: #{location} to exist, but it did" end end def have_file(*args) HaveFile.new(args) end alias_method :contain_file, :have_file end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
file-spec-0.1.0 | lib/file_spec/matchers/abstract/have_file_item.rb |