From 4221123276f5607bb01313a1bc1758302312f3c1 Mon Sep 17 00:00:00 2001 From: Trevor John Date: Mon, 16 Mar 2020 10:55:03 -0400 Subject: [PATCH] Setting view causes state change on default view --- lib/blueprinter/view_collection.rb | 2 +- spec/integrations/shared/base_render_examples.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/blueprinter/view_collection.rb b/lib/blueprinter/view_collection.rb index cf339644..a638f7ea 100644 --- a/lib/blueprinter/view_collection.rb +++ b/lib/blueprinter/view_collection.rb @@ -78,7 +78,7 @@ def add_to_ordered_fields(ordered_fields, definition, fields, view_name_filter = end def merge_fields(source_fields, included_fields) - source_fields.merge! included_fields + source_fields.merge included_fields end end end diff --git a/spec/integrations/shared/base_render_examples.rb b/spec/integrations/shared/base_render_examples.rb index 96b6d14f..64e88c4b 100644 --- a/spec/integrations/shared/base_render_examples.rb +++ b/spec/integrations/shared/base_render_examples.rb @@ -409,6 +409,7 @@ def self.unless_method(_field_name, _object, _options) expect(blueprint.render(obj, view: :normal)).to eq(normal) expect(blueprint.render(obj, view: :extended)).to eq(ext) expect(blueprint.render(obj, view: :special)).to eq(special) + expect(blueprint.render(obj)).to eq(no_view) end end