Sha256: 3adb5ddfa24f22efca4c94f05a27634c1c10ebc8c645b825e7061acd932d7055

Contents?: true

Size: 575 Bytes

Versions: 8

Compression:

Stored size: 575 Bytes

Contents

require 'spec_helper'

describe Mongoid::Report do

  describe '.summary' do
    let(:klass) { Model }
    let(:yesterday) { Date.parse("19-12-2004") }
    let(:today) { Date.parse("20-12-2004") }

    it 'returns summary for all rows' do
      klass.create!(day: today     , field1: 1)
      klass.create!(day: today     , field1: 1)
      klass.create!(day: yesterday , field1: 1)

      example = Report3.new
      rows = example.aggregate_for(klass)
      rows = rows.all

      expect(rows.count).to eq(2)
      expect(rows.summary[:field1]).to eq(3)
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
mongoid-report-0.1.2 spec/mongoid/report/summary_spec.rb
mongoid-report-0.1.1 spec/mongoid/report/summary_spec.rb
mongoid-report-0.1.0 spec/mongoid/report/summary_spec.rb
mongoid-report-0.0.11 spec/mongoid/report/summary_spec.rb
mongoid-report-0.0.10 spec/mongoid/report/summary_spec.rb
mongoid-report-0.0.9 spec/mongoid/report/summary_spec.rb
mongoid-report-0.0.8 spec/mongoid/report/summary_spec.rb
mongoid-report-0.0.7 spec/mongoid/report/summary_spec.rb