33 lines
955 B
Ruby
33 lines
955 B
Ruby
require 'spec_helper'
|
|
|
|
describe RetailerInvitation do
|
|
|
|
let(:retailer) {FactoryBot.create(:retailer)}
|
|
|
|
it "created by factory" do
|
|
FactoryBot.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
|
|
|
|
FactoryBot.create(:retailer_invitation)
|
|
RetailerInvitation.index(retailer, {})[:query].count.should eql 0
|
|
RetailerInvitation.index(retailer, {})[:query].count.should eql 0
|
|
|
|
FactoryBot.create(:retailer_invitation, retailer: retailer, )
|
|
RetailerInvitation.index(retailer, {})[:query].count.should eql 1
|
|
|
|
FactoryBot.create(:retailer_invitation, retailer: retailer, )
|
|
RetailerInvitation.index(retailer, {})[:query].count.should eql 2
|
|
|
|
end
|
|
|
|
|
|
end
|
|
end |