2019-03-30 07:23:56 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2019-08-29 07:56:52 +00:00
|
|
|
require 'spec_helper'
|
2017-09-19 03:18:51 +00:00
|
|
|
|
|
|
|
describe BlocksJsonSerialization do
|
2020-05-19 15:08:04 +00:00
|
|
|
before do
|
|
|
|
stub_const('DummyModel', Class.new)
|
|
|
|
DummyModel.class_eval do
|
|
|
|
include BlocksJsonSerialization
|
|
|
|
end
|
2017-09-19 03:18:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'blocks as_json' do
|
2017-12-19 21:44:54 +00:00
|
|
|
expect { DummyModel.new.as_json }
|
2017-12-01 17:33:02 +00:00
|
|
|
.to raise_error(described_class::JsonSerializationError, /DummyModel/)
|
2017-09-19 03:18:51 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'blocks to_json' do
|
|
|
|
expect { DummyModel.new.to_json }
|
2017-12-01 17:33:02 +00:00
|
|
|
.to raise_error(described_class::JsonSerializationError, /DummyModel/)
|
2017-09-19 03:18:51 +00:00
|
|
|
end
|
|
|
|
end
|