Sha256: 3b714783898bf3fcc0edd8729ade4b942a515373320773daf9ad3558182066d5

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
require 'mitamirri'

describe "ContentReport" do

  before :all do
    @args = {
      :site => 'www.foo.com',
      :time_period => 'past 3 months',
      :visit_kind => 'search'
    }
    TrackableSession.stubs(:search).returns([])
    @report = Mitamirri::ContentReport.new(@args)
  
  end
  
  it 'initializes with arguments' do
    @report.site.should == @args[:site]
    @report.time_period.should == @args[:time_period]
    @report.visit_kind.should == @args[:visit_kind]
  end

  it 'calculates its dates' do
    @report.dates.should == [
      (Time.zone.now - 2.months).beginning_of_month,
      (Time.zone.now - 1.months).beginning_of_month,
      (Time.zone.now).end_of_month,
    ]
  end
  
  it 'creates a ContentStat object from arguments' do
    _stat = Mitamirri::ContentReport::ContentStat.new(:url => '/', :views => 3)
    _stat.views.should == 3
    _stat.url.should == '/'
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mitamirri-0.13.8 spec/lib/content_report_spec.rb