Skip to content

Commit f421497

Browse files
committedNov 27, 2014
Add failing specs for defining methods on modules
1 parent e0b8997 commit f421497

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed
 

‎examples/rack/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tmp

‎spec/opal/core/runtime/donate_spec.rb

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
require 'spec_helper'
2+
3+
module RuntimeDonatingMethods
4+
module A
5+
def baz
6+
'a'
7+
end
8+
end
9+
10+
module B
11+
end
12+
13+
class C
14+
include A
15+
include B
16+
17+
def foo; 'c'; end
18+
end
19+
20+
module B
21+
def foo; 'b'; end
22+
def bar; 'b'; end
23+
def baz; 'b'; end
24+
end
25+
26+
module A
27+
def bar; 'a'; end
28+
end
29+
end
30+
31+
describe 'Donating methods in the runtime' do
32+
before do
33+
@c = RuntimeDonatingMethods::C.new
34+
end
35+
36+
it 'class methods should not get overwritten by methods from modules' do
37+
@c.foo.should == 'c'
38+
end
39+
40+
it 'methods defined in modules should respect the include order in a class' do
41+
@c.bar.should == 'b'
42+
@c.baz.should == 'b'
43+
end
44+
end

0 commit comments

Comments
 (0)
Please sign in to comment.