Sha256: 4df9efcf9d81206995e9e73d79694e3d77d2e13222925e90154cad3e88ca049f
Contents?: true
Size: 1.03 KB
Versions: 3
Compression:
Stored size: 1.03 KB
Contents
require 'spec_helper' module Bogus describe ClassMethods do class SampleClass def foo(bar) end def self.bar(bam) end def self.hello end def self.__shadow__; end def self.__reset__; end def self.__overwrite__; end def self.__overwritten_methods__; end def self.__record__; end end let(:class_methods) { ClassMethods.new(SampleClass) } it "lists the class methods excluding the ones added by Bogus" do expect(class_methods.all).to match_array([:bar, :hello]) end it "returns the instance methods by name" do expect(class_methods.get(:bar)).to eq SampleClass.method(:bar) end it "removes methods by name" do class_methods.remove(:hello) expect(SampleClass).to_not respond_to(:hello) end it "defines instance methods" do class_methods.define <<-EOF def greet(name) return "Hello, " + name + "!" end EOF expect(SampleClass.greet("Joe")).to eq "Hello, Joe!" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bogus-0.1.7 | spec/bogus/fakes/class_methods_spec.rb |
bogus-0.1.6 | spec/bogus/fakes/class_methods_spec.rb |
bogus-0.1.5 | spec/bogus/fakes/class_methods_spec.rb |