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

Commit d389abc

Browse files
committed
Update props validation spec to match reactjs v15
1 parent 8639e04 commit d389abc

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

spec/react/component_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ def render; div; end
428428
}
429429
renderToDocument(Foo, bar: 10, lorem: Lorem.new)
430430
`window.console.warn = org_warn_console; window.console.error = org_error_console;`
431-
expect(`log`).to eq(["Warning: Failed propType: In component `Foo`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String"])
431+
expect(`log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String/)
432432
end
433433

434434
it 'should not log anything if validation pass' do

spec/react/param_declaration_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def render; div; end
8888
renderToDocument(Foo2, bar: 10, lorem: Lorem.new)
8989
`window.console.warn = org_warn_console; window.console.error = org_error_console;`
9090

91-
expect(`log`).to eq(["Warning: Failed propType: In component `Foo2`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String"])
91+
expect(`log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo2`\nRequired prop `foo` was not specified\nProvided prop `bar` could not be converted to String/)
9292
end
9393

9494
it 'should not log anything if validation passes' do
@@ -134,7 +134,7 @@ def render; div; end
134134
param :bar, type: []
135135
end
136136
renderToDocument(Foo, foo: 10, bar: [10])
137-
expect(`window.dummy_log`).to eq(["Warning: Failed propType: In component `Foo`\nProvided prop `foo` could not be converted to Array"])
137+
expect(`window.dummy_log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to Array/)
138138
end
139139

140140
it "can use the [xxx] notation for arrays of a specific type" do
@@ -143,7 +143,7 @@ def render; div; end
143143
param :bar, type: [String]
144144
end
145145
renderToDocument(Foo, foo: [10], bar: ["10"])
146-
expect(`window.dummy_log`).to eq(["Warning: Failed propType: In component `Foo`\nProvided prop `foo`[0] could not be converted to String"])
146+
expect(`window.dummy_log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo`\[0\] could not be converted to String/)
147147
end
148148

149149
it "can convert a json hash to a type" do
@@ -168,7 +168,7 @@ def render
168168

169169
params = { foo: "", bar: { bazwoggle: 1 }, baz: [{ bazwoggle: 2 }] }
170170
expect(Foo).to render('<span>1, 2</span>').with_params(params)
171-
expect(`window.dummy_log`).to eq(["Warning: Failed propType: In component `Foo`\nProvided prop `foo` could not be converted to BazWoggle"])
171+
expect(`window.dummy_log[0]`).to match(/Warning: Failed prop( type|Type): In component `Foo`\nProvided prop `foo` could not be converted to BazWoggle/)
172172
end
173173

174174
describe "converts params only once" do

0 commit comments

Comments
 (0)