From 516e0d61bbe939268501f3d29c1078030776e041 Mon Sep 17 00:00:00 2001 From: Gannon McGibbon Date: Wed, 3 Oct 2018 13:50:19 -0400 Subject: Move test_fixtures and render_context to separate files --- .../lib/active_record/fixture_set/render_context.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 activerecord/lib/active_record/fixture_set/render_context.rb (limited to 'activerecord/lib/active_record/fixture_set') diff --git a/activerecord/lib/active_record/fixture_set/render_context.rb b/activerecord/lib/active_record/fixture_set/render_context.rb new file mode 100644 index 0000000000..c90b5343dc --- /dev/null +++ b/activerecord/lib/active_record/fixture_set/render_context.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +# NOTE: This class has to be defined in compact style in +# order for rendering context subclassing to work correctly. +class ActiveRecord::FixtureSet::RenderContext # :nodoc: + def self.create_subclass + Class.new(ActiveRecord::FixtureSet.context_class) do + def get_binding + binding() + end + + def binary(path) + %(!!binary "#{Base64.strict_encode64(File.read(path))}") + end + end + end +end -- cgit v1.2.3