Sha256: c8220346f3f4af5265c42457da2da4a2744f3d61e49bebe06b9192203f0c4d6a

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

require 'spec_helper'

module Prosperity
  describe Extractors::Base do
    let(:metric) { UsersMetric.new }
    subject { Extractors::Change.new(metric, 'default', start_time, end_time, period) }
    let(:data) { subject.to_a }

    let(:start_time) { Time.new(1981, 7, 10) }
    let(:end_time) { Time.new(2012, 7, 10) }

    context "Month period" do
      let(:period) { Periods::MONTH }

      it { subject.start_time.to_i.should == Time.new(1981, 7, 1).to_i }
      it { subject.end_time.to_i.should == Time.new(2012, 7, 31, 23, 59, 59).to_i }
    end

    context "Week period" do
      let(:period) { Periods::WEEK }

      it { subject.start_time.to_i.should == Time.new(1981, 7, 6).to_i }
      it { subject.end_time.to_i.should == Time.new(2012, 7, 15, 23, 59, 59).to_i }
    end

    context "Day period" do
      let(:period) { Periods::DAY }

      it { subject.start_time.to_i.should == Time.new(1981, 7, 10, 0, 0, 0).to_i }
      it { subject.end_time.to_i.should == Time.new(2012, 7, 10, 23, 59, 59).to_i }
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
prosperity-0.0.9 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.8 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.7 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.6 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.5 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.4 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.3 spec/lib/prosperity/extractors/base_spec.rb
prosperity-0.0.2 spec/lib/prosperity/extractors/base_spec.rb