Sha256: be5bcc6eb796e08f9055fd6d231da45a46e877f89439e85678da13b7583a3be2

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

module Ecology
  module Test
    def set_up_ecology(file_contents, filename = "some.ecology", options = {})
      match = filename.match(/^(.*)\.erb$/)
      if match
        ENV["ECOLOGY_SPEC"] = match[1]
        File.stubs(:exist?).with(match[1]).returns(false)
      else
        ENV["ECOLOGY_SPEC"] = filename
      end

      File.stubs(:exist?).with(filename + ".erb").returns(false)
      File.stubs(:exist?).with(filename).returns(true)

      unless options[:no_read]
        File.expects(:read).with(filename).returns(file_contents).at_least_once
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ecology-0.0.18 lib/ecology/test_methods.rb