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