Sha256: 1ef2fcb19785d400113b5e9906204ccdc6e04398efcea884269e9909d04ff465
Contents?: true
Size: 1.38 KB
Versions: 2
Compression:
Stored size: 1.38 KB
Contents
module ActiveModel class Serializer class AdapterForTest < Minitest::Test def setup @previous_adapter = ActiveModel::Serializer.config.adapter end def teardown ActiveModel::Serializer.config.adapter = @previous_adapter end def test_returns_default_adapter adapter = ActiveModel::Serializer.adapter assert_equal ActiveModel::Serializer::Adapter::Json, adapter end def test_overwrite_adapter_with_symbol ActiveModel::Serializer.config.adapter = :null adapter = ActiveModel::Serializer.adapter assert_equal ActiveModel::Serializer::Adapter::Null, adapter ensure end def test_overwrite_adapter_with_class ActiveModel::Serializer.config.adapter = ActiveModel::Serializer::Adapter::Null adapter = ActiveModel::Serializer.adapter assert_equal ActiveModel::Serializer::Adapter::Null, adapter end def test_raises_exception_if_invalid_symbol_given ActiveModel::Serializer.config.adapter = :unknown assert_raises ArgumentError do ActiveModel::Serializer.adapter end end def test_raises_exception_if_it_does_not_know_hot_to_infer_adapter ActiveModel::Serializer.config.adapter = 42 assert_raises ArgumentError do ActiveModel::Serializer.adapter end end end end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
cm-active_model_serializers-0.10.0.rc1.1 | test/serializers/adapter_for_test.rb |
active_model_serializers-0.10.0.rc1 | test/serializers/adapter_for_test.rb |