Skip to content

Instantly share code, notes, and snippets.

@groyoh
Last active June 4, 2016 14:06
Show Gist options
  • Save groyoh/34356f48dbbbb2a70e1f6a52e19e6351 to your computer and use it in GitHub Desktop.
Save groyoh/34356f48dbbbb2a70e1f6a52e19e6351 to your computer and use it in GitHub Desktop.
AMS 1773
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'rails', '4.2.4'
gem 'active_model_serializers'
end
class ParentFoo < ActiveModelSerializers::Model
attr_accessor :id, :name, :percent_complete, :scheduled_children
end
class Foo < ParentFoo
end
class ParentFooSerializer < ActiveModel::Serializer
attribute :name
end
require 'minitest/autorun'
class InheritanceTest < Minitest::Test
def test_inheritance
serialized_foo = ActiveModelSerializers::SerializableResource.new(Foo.new(name: "foo")).as_json
assert_equal(serialized_foo, name: "foo")
end
end
__END__
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies....
Using rake 11.1.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.0.0
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using thor 0.19.1
Using arel 6.0.3
Using bundler 1.12.4
Using concurrent-ruby 1.0.2
Using tzinfo 1.2.2
Using nokogiri 1.6.7.2
Using rack-test 0.6.3
Using mime-types 3.1
Using sprockets 3.6.0
Using activesupport 4.2.4
Using loofah 2.0.3
Using mail 2.6.4
Using rails-deprecated_sanitizer 1.0.3
Using globalid 0.3.6
Using activemodel 4.2.4
Using rails-html-sanitizer 1.0.3
Using rails-dom-testing 1.0.7
Using activejob 4.2.4
Using activerecord 4.2.4
Using actionview 4.2.4
Using actionpack 4.2.4
Using actionmailer 4.2.4
Using railties 4.2.4
Using sprockets-rails 3.0.4
Using active_model_serializers 0.10.0
Using rails 4.2.4
Run options: --seed 2200
# Running:
[active_model_serializers] Rendered ParentFooSerializer with ActiveModelSerializers::Adapter::Attributes (0.09ms)
.
Finished in 0.005555s, 180.0158 runs/s, 180.0158 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment