Sha256: 5d8ccb302877c3fcc82aede9e242700284709e2c2d6b14f790d149500731bdaf

Contents?: true

Size: 646 Bytes

Versions: 3

Compression:

Stored size: 646 Bytes

Contents

module AssetsPackager
  module Matchers
    class ChangeFileLines < RSpec::Matchers::Change #:nodoc:
      def initialize(path, message=nil, &block)
        @path, @message = path, message
        @value_proc = block
      end

      def matches?(event_proc)
        raise_block_syntax_error if block_given?

        @before_lines = ::File.readlines(@path).size
        event_proc.call
        @after_lines = ::File.readlines(@path).size

        @before_lines != @after_lines
      end
    end

    def change_file_lines(path=nil, message=nil, &block)
      AssetsPackager::Matchers::ChangeFileLines.new(path, message, &block)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
assets_packager-0.0.2 spec/support/matchers/change_file_lines.rb
assets_packager-0.0.1.1 spec/support/matchers/change_file_lines.rb
assets_packager-0.0.1 spec/support/matchers/change_file_lines.rb