Sha256: 0514dad500c58c33a977adf5cbffc027597ad95d11077b265b1180a954c2ad6e
Contents?: true
Size: 804 Bytes
Versions: 27
Compression:
Stored size: 804 Bytes
Contents
# frozen_string_literal: true # encoding: utf-8 require "spec_helper" describe Mongoid::Extensions::Module do describe "#re_define_method" do context "when the method already exists" do class Smoochy def sing "singing" end end before do Smoochy.re_define_method("sing") do "singing again" end end it "redefines the existing method" do expect(Smoochy.new.sing).to eq("singing again") end end context "when the method does not exist" do class Rhino end before do Rhino.re_define_method("sing") do "singing" end end it "redefines the existing method" do expect(Rhino.new.sing).to eq("singing") end end end end
Version data entries
27 entries across 27 versions & 2 rubygems