Sha256: fc219df3fdeb4793c9ff61ebf4513e83e435542f2d9c846d6467433736f80899

Contents?: true

Size: 1.06 KB

Versions: 29

Compression:

Stored size: 1.06 KB

Contents

module FileMacros
  module ExampleMethods

    def files_should_be_identical(first, second)
      identical_files?(first, second).should be(true)
    end

    def files_should_not_be_identical(first, second)
      identical_files?(first, second).should be(false)
    end

    def file_should_exist(file)
      File.exists?(file).should be(true), "File #{file} should exist"
    end

    def directory_should_exist(dir)
      File.exists?(dir).should be(true), "Directory #{dir} should exist"
      File.directory?(dir).should be(true), "#{dir} should be a directory"
    end

    def directory_should_not_exist(dir)
      File.exists?(dir).should be(false), "Directory #{dir} should not exist"
    end

    def file_should_not_exist(file)
      File.exists?(file).should be(false), "File #{file} should not exist"
    end

    def identical_files?(first, second)
      file_should_exist(first)
      file_should_exist(second)
      open(second, 'r').read.should == open(first, 'r').read
    end
  end

  def self.included(receiver)
    receiver.send :include, ExampleMethods
  end
end

Version data entries

29 entries across 29 versions & 3 rubygems

Version Path
sitemap_generator-5.2.0 spec/support/file_macros.rb
sitemap_generator-5.1.0 spec/support/file_macros.rb
sitemap_generator-5.0.5 spec/support/file_macros.rb
ftbpro_sitemap_generator-5.0.8 spec/support/file_macros.rb
sitemap_generator_ftbpro-5.0.6 spec/support/file_macros.rb
sitemap_generator_ftbpro-5.0.5 spec/support/file_macros.rb
sitemap_generator_ftbpro-5.0.4 spec/support/file_macros.rb
sitemap_generator-5.0.4 spec/support/file_macros.rb
sitemap_generator-5.0.3 spec/support/file_macros.rb
sitemap_generator-5.0.2 spec/support/file_macros.rb
sitemap_generator-5.0.1 spec/support/file_macros.rb
sitemap_generator-5.0.0 spec/support/file_macros.rb
sitemap_generator-5.0.0.beta1 spec/support/file_macros.rb
sitemap_generator-5.0.0.beta spec/support/file_macros.rb
sitemap_generator-4.3.1 spec/support/file_macros.rb
sitemap_generator-4.3.0 spec/support/file_macros.rb
sitemap_generator-4.2.0 spec/support/file_macros.rb
sitemap_generator-4.1.1 spec/support/file_macros.rb
sitemap_generator-4.1.0 spec/support/file_macros.rb
sitemap_generator-4.0.1 spec/support/file_macros.rb