Skip to content

Commit 91075ff

Browse files
alpaca-tcpirj
authored andcommitted
Fix the type of options passed to render
1 parent f87fcc8 commit 91075ff

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/rspec/rails/example/view_example_group.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ def _default_render_options
152152
render_options = {template: match[:template]}
153153
render_options[:handlers] = [match[:handler].to_sym] if match[:handler]
154154
render_options[:formats] = [match[:format].to_sym] if match[:format]
155-
render_options[:locales] = [match[:locale]] if match[:locale]
156-
render_options[:variants] = [match[:variant]] if match[:variant]
155+
render_options[:locales] = [match[:locale].to_sym] if match[:locale]
156+
render_options[:variants] = [match[:variant].to_sym] if match[:variant]
157157

158158
render_options
159159
end

spec/rspec/rails/example/view_example_group_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,19 +151,19 @@ def _default_file_to_render; end # Stub method
151151
it "converts the filename components into render options" do
152152
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.html.erb" }
153153
view_spec.render
154-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: [:erb]}, {}, nil])
154+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: [:en], formats: [:html], handlers: [:erb]}, {}, nil])
155155
end
156156

157157
it "converts the filename with variant into render options" do
158158
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.html+fancy.erb" }
159159
view_spec.render
160-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], formats: [:html], handlers: [:erb], variants: ['fancy']}, {}, nil])
160+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: [:en], formats: [:html], handlers: [:erb], variants: [:fancy]}, {}, nil])
161161
end
162162

163163
it "converts the filename without format into render options" do
164164
allow(view_spec).to receive(:_default_file_to_render) { "widgets/new.en.erb" }
165165
view_spec.render
166-
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: ['en'], handlers: [:erb]}, {}, nil])
166+
expect(view_spec.received.first).to eq([{template: "widgets/new", locales: [:en], handlers: [:erb]}, {}, nil])
167167
end
168168
end
169169

0 commit comments

Comments
 (0)