Sha256: b5f8fbc5ec2ff8f72877724c304f757d1da96e717df51b574223f4ed53f16c14

Contents?: true

Size: 590 Bytes

Versions: 4

Compression:

Stored size: 590 Bytes

Contents

module RSpec::RubyContentMatchers
  class HaveContent
    attr_accessor :file_path

    def initialize
    end

    def matches?(file_path, &block)      
      self.file_path = file_path
      return nil if File.blank? file_path
      file = File.new(file_path)
      yield file.read if block
      true
    end
    
    def failure_message
      display "Expected the file #{file_path} to have content" 
    end 
    
    def negative_failure_message
      display "Did not expect the file #{file_path} to have content" 
    end    
  end

  def have_content
    HaveContent.new
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
code-spec-0.4.0 lib/code_spec/matchers/have_content.rb
code-spec-0.3.0 lib/code_spec/matchers/have_content.rb
code-spec-0.2.11 lib/code_spec/matchers/have_content.rb
code-spec-0.2.9 lib/code_spec/matchers/have_content.rb