Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit 24bf4de

Browse files
committed
Fix test for opal 0.8
1 parent d51f49c commit 24bf4de

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

spec/react/refs_callback_spec.rb

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,36 @@ def render
2020
end
2121

2222
Foo.class_eval do
23-
attr_accessor :my_bar
23+
def my_bar=(bar)
24+
$bar = bar
25+
end
2426

2527
def render
2628
React.create_element(Bar, ref: method(:my_bar=).to_proc)
2729
end
2830
end
2931

3032
element = React.create_element(Foo)
31-
instance = React::Test::Utils.render_into_document(element)
32-
expect(instance.my_bar).to be_a(Bar)
33+
React::Test::Utils.render_into_document(element)
34+
expect($bar).to be_a(Bar)
35+
$bar = nil
3336
end
3437

3538
it "is invoked with the actual DOM node" do
3639
Foo.class_eval do
37-
attr_accessor :my_div
40+
def my_div=(div)
41+
$div = div
42+
end
3843

3944
def render
4045
React.create_element('div', ref: method(:my_div=).to_proc)
4146
end
4247
end
4348

4449
element = React.create_element(Foo)
45-
instance = React::Test::Utils.render_into_document(element)
46-
expect(`#{instance.my_div}.nodeType`).to eq(1)
50+
React::Test::Utils.render_into_document(element)
51+
expect(`#{$div}.nodeType`).to eq(1)
52+
$div = nil
4753
end
4854
end
4955

0 commit comments

Comments
 (0)