Sha256: 417f713ceaf91dfeb7f6d84bd58c8218cac0c11914e25c0a90e022c99feff0ed

Contents?: true

Size: 574 Bytes

Versions: 11

Compression:

Stored size: 574 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
      "Expected the file #{file_path} to have content" 
    end 
    
    def negative_failure_message
      "Did not expect the file #{file_path} to have content" 
    end    
  end

  def have_content
    HaveContent.new
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
code-spec-0.2.8 lib/code_spec/matchers/have_content.rb
code-spec-0.2.7 lib/code_spec/matchers/have_content.rb
code-spec-0.2.6 lib/code_spec/matchers/have_content.rb
code-spec-0.2.5 lib/code_spec/matchers/have_content.rb
code-spec-0.2.4 lib/code_spec/matchers/have_content.rb
code-spec-0.2.3 lib/code_spec/matchers/have_content.rb
code-spec-0.2.2 lib/code_spec/matchers/have_content.rb
code-spec-0.2.1 lib/code_spec/matchers/have_content.rb
code-spec-0.2.0 lib/code_spec/matchers/have_content.rb
code-spec-0.1.3 lib/code_spec/matchers/have_content.rb
code-spec-0.1.2 lib/code_spec/matchers/have_content.rb