Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: 8051da8596
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (39 sloc) 1.163 kB
require File.dirname(__FILE__) + '/../rbmodexcl'
describe Class, "extended with module" do
before(:each) do
@klass = Class.new
@module = Module.new do
def modded? ; true ; end
end
@klass.extend(@module)
@klass.should be_a_kind_of(@module)
end
it "should be unextendable with #unextend" do
@klass.unextend(@module)
@klass.should_not be_a_kind_of(@module)
@klass.should_not respond_to(:modded?)
end
it "should call Module.unextended on #unextend" do
@module.should_receive(:unextended).with(@klass)
@klass.unextend(@module)
end
end
describe Object, "extended with module" do
before(:each) do
@object = Object.new
@module = Module.new do
def modded? ; true ; end
end
@object.extend(@module)
@object.should be_a_kind_of(@module)
end
it "should be unextendable with #unextend" do
@object.unextend(@module)
@object.should_not be_a_kind_of(@module)
@object.should_not respond_to(:modded?)
end
it "should call Module.unextended on #unextend" do
@module.should_receive(:unextended).with(@object)
@object.unextend(@module)
end
end
Jump to Line
Something went wrong with that request. Please try again.