Sha256: f688217a844a3c6a829f6935090090280d666acaa269cf07b628f476b74cd2d3
Contents?: true
Size: 583 Bytes
Versions: 19
Compression:
Stored size: 583 Bytes
Contents
def mock_yaml(hash, path) mock_file = double(path.split("/")[-1]) allow(File).to receive(:exist?).with(path).and_return(true) allow(File).to receive(:open).with(path).and_return(mock_file) allow(Psych).to receive(:load).and_return(hash) end def stub_rails(opts = {}) Object.const_set("Rails", Class) Rails.send(:undef_method, :env) if Rails.respond_to?(:env) Rails.send(:undef_method, :root) if Rails.respond_to?(:root) opts.each { |k, v| Rails.send(:define_method, k) { return v } } end def unstub_rails Object.send(:remove_const, :Rails) if defined?(Rails) end
Version data entries
19 entries across 19 versions & 1 rubygems