require 'spec_helper' describe TeacherDistribution do let(:teacher) {FactoryGirl.create(:teacher_user)} describe "index" do it "empty" do TeacherDistribution.index(teacher, {})[:query].count.should eql 0 end it "returns single" do distribution = FactoryGirl.create(:teacher_distribution, teacher: teacher) TeacherDistribution.index(teacher, {})[:query].count.should eql 1 distribution = FactoryGirl.create(:teacher_distribution) # some random teacher TeacherDistribution.index(teacher, {})[:query].count.should eql 1 end end end