Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'spec_helper'
- describe Artist, "Chart" do
- before(:each) do
- floyd = Artist.make(:name => "Pink Floyd")
- 3.times{ |index| floyd.mentions.make }
- 20.times{ |index| floyd.mentions.make(:older) }
- wizard = Artist.make(:name => "Electric Wizard")
- 10.times{ |index| wizard.mentions.make }
- 10.times{ |index| wizard.mentions.make(:older) }
- zeppelin = Artist.make(:name => "Led Zeppelin")
- 15.times{ |index| zeppelin.mentions.make }
- 5.times{ |index| zeppelin.mentions.make(:older) }
- end
- it "should get the order of a weekly chart correctly" do
- chart = Artist.weekly_chart
- chart[0].name.should == "Led Zeppelin"
- chart[1].name.should == "Electric Wizard"
- chart[2].name.should == "Pink Floyd"
- end
- it "should get the order of a custom chart correctly" do
- start_date = 1.month.ago
- end_date = Time.now
- chart = Artist.chart(start_date, end_date)
- chart[0].name.should == "Pink Floyd"
- chart[1].name.should == "Electric Wizard"
- chart[2].name.should == "Led Zeppelin"
- end
- end
Add Comment
Please, Sign In to add comment