summaryrefslogtreecommitdiff
path: root/spec/models/concerns/blocks_json_serialization_spec.rb
blob: d811b47fa355533b7f644769ea326b4f7ee7c2d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe BlocksJsonSerialization do
  before do
    stub_const('DummyModel', Class.new)
    DummyModel.class_eval do
      include BlocksJsonSerialization
    end
  end

  it 'blocks as_json' do
    expect { DummyModel.new.as_json }
      .to raise_error(described_class::JsonSerializationError, /DummyModel/)
  end

  it 'blocks to_json' do
    expect { DummyModel.new.to_json }
      .to raise_error(described_class::JsonSerializationError, /DummyModel/)
  end
end