require 'helper' class AxleAttributes::DumperTest < ActiveSupport::TestCase class TestModel def self.attributes { 'foo' => AxleAttributes::ParentDefinition.new(self, 'foo', type: :string, version: true), 'momma' => AxleAttributes::ParentDefinition.new(self, 'momma', type: :integer, version: false), } end def self.attribute_set attributes.keys.to_set end end test 'dump_internal' do result = dumper.dump_internal assert_match /Attribute,Display Name,Type,Deprecation/, result assert_match Regexp.new('foo,Foo'), result assert_match Regexp.new('momma,Momma'), result end test 'dump_public' do result = dumper.dump_public(['foo']) assert_match /Attribute,Display Name,Type,Description/, result assert_match Regexp.new('foo,Foo'), result refute_match Regexp.new('momma,Momma'), result end private def dumper @dumper ||= AxleAttributes::Dumper.new(TestModel) end end