2020-11-03 01:24:20 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-11-30 22:20:10 +01:00
|
|
|
require_relative '../../plugin_helper'
|
2020-11-03 01:24:20 +01:00
|
|
|
|
|
|
|
describe CustomWizard::LogSerializer do
|
|
|
|
fab!(:user) { Fabricate(:user) }
|
2021-02-24 08:50:42 +01:00
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
it 'should return log attributes' do
|
|
|
|
CustomWizard::Log.create("First log message")
|
|
|
|
CustomWizard::Log.create("Second log message")
|
2021-02-24 08:50:42 +01:00
|
|
|
|
2020-11-03 01:24:20 +01:00
|
|
|
json_array = ActiveModel::ArraySerializer.new(
|
|
|
|
CustomWizard::Log.list(0),
|
|
|
|
each_serializer: CustomWizard::LogSerializer
|
2021-02-24 08:50:42 +01:00
|
|
|
).as_json
|
2020-11-03 01:24:20 +01:00
|
|
|
expect(json_array.length).to eq(2)
|
|
|
|
expect(json_array[0][:message]).to eq("Second log message")
|
|
|
|
end
|
2021-02-24 08:50:42 +01:00
|
|
|
end
|