Sha256: 0056227d524b9c3f244d9bfc0f220982920f36cf5e26fccb8fe6265da7f00b7e

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require 'useful/ruby_extensions/string' unless String.new.respond_to?(:constantize)

module TestBelt; end
module TestBelt::ShouldaMacros; end
module TestBelt::ShouldaMacros::Files

  def should_have_files(*files)
    the_files = files.flatten
    if the_files.empty?
      should "have @root_path" do
        assert @root_path, "the variable @root_path is not defined"
        assert File.exists?(@root_path), "'#{@root_path}' does not exist"
      end
    else
      the_files.each do |file|
        should "have the file '#{file}' in @root_path" do
          assert @root_path, "the variable @root_path is not defined"
          assert File.exists?(File.join(@root_path, file)), "'#{file}' does not exist in '#{@root_path}'"
        end
      end
    end
  end
  protected :should_have_files

  alias_method :should_have_file, :should_have_files
  alias_method :should_have_directories, :should_have_files
  alias_method :should_have_directory, :should_have_files

end

Test::Unit::TestCase.extend(TestBelt::ShouldaMacros::Files) if defined? Test::Unit::TestCase

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
test-belt-0.2.0 lib/test_belt/shoulda_macros/files.rb
test-belt-0.1.2 lib/test_belt/shoulda_macros/files.rb
test-belt-0.1.1 lib/test_belt/shoulda_macros/files.rb
test-belt-0.1.0 lib/test_belt/shoulda_macros/files.rb