Sha256: 24acfc3da1a6e4dae4c6b38694a5674b06f07246f98a698bfb87b657e0263f90

Contents?: true

Size: 598 Bytes

Versions: 35

Compression:

Stored size: 598 Bytes

Contents

def mock_yaml(hash, path)
  mock_file = instance_double(File, 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

35 entries across 35 versions & 1 rubygems

Version Path
active-fedora-12.2.4 spec/config_helper.rb
active-fedora-12.2.3 spec/config_helper.rb
active-fedora-11.5.6 spec/config_helper.rb
active-fedora-12.2.2 spec/config_helper.rb
active-fedora-11.2.1 spec/config_helper.rb
active-fedora-12.2.1 spec/config_helper.rb
active-fedora-12.0.3 spec/config_helper.rb
active-fedora-11.5.5 spec/config_helper.rb
active-fedora-13.1.2 spec/config_helper.rb
active-fedora-13.1.1 spec/config_helper.rb
active-fedora-13.1.0 spec/config_helper.rb
active-fedora-13.0.0 spec/config_helper.rb
active-fedora-12.1.1 spec/config_helper.rb
active-fedora-12.1.0 spec/config_helper.rb
active-fedora-11.5.4 spec/config_helper.rb
active-fedora-11.5.3 spec/config_helper.rb
active-fedora-12.0.2 spec/config_helper.rb
active-fedora-12.0.1 spec/config_helper.rb
active-fedora-11.5.2 spec/config_helper.rb
active-fedora-12.0.0 spec/config_helper.rb