require 'spec_helper'

describe JamClassReport do

  it "wee bit of data" do
    pending "lessons paused"
    user = FactoryGirl.create(:user, origin_utm_campaign: 'legacy')

    query = JamClassReport.analyse
    query.length.should eql 2
    r1 = query[0]

    r1.cohort.should eql Date.new(user.created_at.year, user.created_at.month, 1)
    r1.registrations.should eql 1
    r1.campaign.should eql 'legacy'
    r1.spend.should be_nil
    r1.registrations.should eql 1
    r1.td_customers.should eql 0
    r1.jamclass_rev.should be_nil
    r1.td4.should eql 0
    r1.td2.should eql 0
    r1.td1.should eql 0
    r1.spend_td.should be_nil
    r1.purchases0.should eql 1
    r1.purchases1.should eql 0
    r1.purchases2.should eql 0
    r1.purchases3.should eql 0
    r1.purchases_rest.should eql 0

    r2 = query[1]
    r2.cohort.should be_nil
    r2.registrations.should eql 1
    r2.campaign.should eql 'legacy'
    r2.spend.should be_nil
    r2.registrations.should eql 1
    r2.td_customers.should eql 0
    r2.jamclass_rev.should be_nil
    r2.td4.should eql 0
    r2.td2.should eql 0
    r2.td1.should eql 0
    r2.spend_td.should be_nil
    r2.purchases0.should eql 1
    r2.purchases1.should eql 0
    r2.purchases2.should eql 0
    r2.purchases3.should eql 0
    r2.purchases_rest.should eql 0

  end
end