-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions_spec.rb
42 lines (36 loc) · 920 Bytes
/
options_spec.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
require "spec_helper"
RSpec.describe "Options component" do
class OptionsComponent < RailsReactComponents::Component
component :different_name
id "component-id"
html_option "color", "red"
html_option "opacity", "0.5"
prerender
trace
replay_console
raise_on_prerender_error
def different_name
"JokeComponent"
end
end
describe "#build" do
it "calls react_component with all specified options" do
component = OptionsComponent.new
expect(component.component_options).to eq(
{
props: {},
id: "component-id",
html_options: {
"color" => "red",
"opacity" => "0.5"
},
trace: true,
replay_console: true,
raise_on_prerender_error: true,
prerender: true
}
)
expect(component.component).to eq "JokeComponent"
end
end
end