I am new to Rspec, i am trying to write a test for a simple feature.
A user creates a contract, if the contract the is created and has a specific value on its property then i send an email to notify the teacher. How do i write the condition in the test?
I am using letter_opener and ActionMailer.
describe "When a user creates a apprentice contract" do
let(:admin) { users(:admin) }
before { signin admin }
it "should send an email to the teacher" do
contract = create(:contract)
contract.education_type.must_equal("company_apprentice")
end
end
when contract.education_type.must_equal("school_apprentice")
is true i want to test if it sends an email.
How do i write that in this test?