require 'spec_helper' describe RetailerInvitation do let(:retailer) {FactoryGirl.create(:retailer)} it "created by factory" do FactoryGirl.create(:retailer_invitation) end it "created by method" do RetailerInvitation.create(retailer.user, retailer, {first_name: "Bobby", last_name: "Jimes", email: 'somewhere@jamkazam.com'}) end describe "index" do it "works" do RetailerInvitation.index(retailer, {})[:query].count.should eql 0 FactoryGirl.create(:retailer_invitation) RetailerInvitation.index(retailer, {})[:query].count.should eql 0 RetailerInvitation.index(retailer, {})[:query].count.should eql 0 FactoryGirl.create(:retailer_invitation, retailer: retailer, ) RetailerInvitation.index(retailer, {})[:query].count.should eql 1 FactoryGirl.create(:retailer_invitation, retailer: retailer, ) RetailerInvitation.index(retailer, {})[:query].count.should eql 2 end end end