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

Commit 177b740

Browse files
committed
Fix arity check for component initializer
1 parent 95f6175 commit 177b740

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

spec/react/component_spec.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
stub_const 'Foo', Class.new
1111
Foo.class_eval do
1212
include React::Component
13+
def initialize(native = nil)
14+
end
15+
1316
def render
1417
React.create_element('div')
1518
end
@@ -766,7 +769,7 @@ def render
766769
Foo.define_method :needs_update? do |next_params, next_state|
767770
next_params.changed?
768771
end
769-
@foo = Foo.new
772+
@foo = Foo.new(nil)
770773
end
771774

772775
it "returns false if new and old params are the same" do
@@ -794,7 +797,7 @@ def render
794797
Foo.define_method :needs_update? do |next_params, next_state|
795798
next_state.changed?
796799
end
797-
@foo = Foo.new
800+
@foo = Foo.new(nil)
798801
end
799802

800803
it "returns false if both new and old states are empty" do

spec/react/react_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def render
109109
`var count = 0;`
110110

111111
Foo.class_eval do
112-
def initialize
112+
def initialize(native)
113113
`count = count + 1;`
114114
end
115115
def render

0 commit comments

Comments
 (0)