Sha256: 100b3bac173ce56e351c83b3e74b78e32893724bf5f2d76879bf5a8eb48aeabd
Contents?: true
Size: 738 Bytes
Versions: 1
Compression:
Stored size: 738 Bytes
Contents
require 'spec_helper' describe Mongoid::Report do let(:klass) { Model } it 'allows to save options per report and attached model' do 2.times { klass.create!(field1: 1) } Report = Class.new do include Mongoid::Report report 'example' do attach_to Model do columns :'new-field' => ->(context, row, options) { row[context.mapping('example-models')['field3'].to_s] } mapping :'field3' => :field1 column :field1, :'new-field' end end end example = Report.new rows = example.aggregate_for('example-models') rows = rows.all expect(rows.size).to eq(1) expect(rows[0]['field1']).to eq(2) expect(rows[0]['new-field']).to eq(2) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongoid-report-0.1.7 | spec/mongoid/report/set_spec.rb |