Sha256: a0f28223cb9077d083738461030efaf547dca74898689f5f8129661c663ae681
Contents?: true
Size: 842 Bytes
Versions: 1
Compression:
Stored size: 842 Bytes
Contents
require 'spec_helper' module Prosperity describe Extractors::Count do let(:start_time) { 1.year.ago } let(:end_time) { start_time + 1.year } let(:period) { Periods::MONTH } subject { Extractors::Count.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 "returns the counts at it increases" do data[0].should == 1 data[-1].should == 2 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/count_spec.rb |