* add hash benchmarking to performance tests * Add missing attribute in README example * Disable GC before doing performance test * Enable oj to AM for fair benchmark test * ability to customize rendering of attributes via a block * fixed attribute render spec * minimized specs to specifially test this feature * Update README to include attribute definitions * Fixed syntax error * Fixed merge issues
14 lines
518 B
Ruby
14 lines
518 B
Ruby
require 'spec_helper'
|
|
|
|
describe FastJsonapi::ObjectSerializer do
|
|
include_context 'movie class'
|
|
|
|
context 'when including attribute blocks' do
|
|
it 'returns correct hash when serializable_hash is called' do
|
|
serializable_hash = MovieSerializerWithAttributeBlock.new([movie]).serializable_hash
|
|
expect(serializable_hash[:data][0][:attributes][:name]).to eq movie.name
|
|
expect(serializable_hash[:data][0][:attributes][:title_with_year]).to eq "#{movie.name} (#{movie.release_year})"
|
|
end
|
|
end
|
|
end
|