Skip to content
Browse files

Add simple spec for ruby prepend

  • Loading branch information...
1 parent df43311 commit 48e6c1eaeb71fe120df6807c3eb6c6a9d6dd3ade @LTe LTe committed Aug 3, 2012
Showing with 22 additions and 0 deletions.
  1. +14 −0 spec/ruby/core/module/fixtures/classes.rb
  2. +8 −0 spec/ruby/core/module/prepend_spec.rb
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

0 comments on commit 48e6c1e

Please sign in to comment.
Something went wrong with that request. Please try again.