Sha256: 9a1fded93c37076b1a23c3a91ac43208ac51d8015d06978d24398c55ddd031ab
Contents?: true
Size: 814 Bytes
Versions: 1
Compression:
Stored size: 814 Bytes
Contents
require 'spec_helper' module Prosperity describe Extractors::Group do let(:start_time) { 1.year.ago } let(:end_time) { start_time + 1.year } let(:period) { Periods::MONTH } subject { Extractors::Group.new(metric, start_time, end_time, period) } before do User.delete_all [2.years.ago, 1.month.ago, 1.month.from_now].each do |time| User.create created_at: time end end context "simple scope" do let(:metric) { OpenStruct.new(scope: User, group_by: :created_at) } describe "#to_a" do let(:data) { subject.to_a } it "returns the one entry per period" do data.size.should == 12 end it "only returns models from that period" do data.sum.should == 1 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
prosperity-0.0.1 | spec/lib/prosperity/extractors/group_spec.rb |