Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add simple spec for ruby prepend

  • Loading branch information...
commit 48e6c1eaeb71fe120df6807c3eb6c6a9d6dd3ade 1 parent df43311
@LTe LTe authored
View
14 spec/ruby/core/module/fixtures/classes.rb
@@ -380,6 +380,20 @@ def extend_object(obj)
private :extend_object
end
end
+
+ module ModuleToPrepend
+ def m
+ result = super if defined?(super)
+ [:m, result]
+ end
+ end
+
+ class ClassToPrepend
+ prepend ModuleToPrepend if respond_to?(:prepend)
+ def m
+ :c
+ end
+ end
end
class Object
View
8 spec/ruby/core/module/prepend_spec.rb
@@ -0,0 +1,8 @@
+require File.expand_path('../../../spec_helper', __FILE__)
+require File.expand_path('../fixtures/classes', __FILE__)
+
+describe "Module#prepend" do
+ it "prepends module do class" do
+ ModuleSpecs::ClassToPrepend.new.m.should == [:m, :c]
+ end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.