Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Last active August 29, 2015 14:00
Show Gist options
  • Save tarynsauer/a75e1449efe055ebb8be to your computer and use it in GitHub Desktop.
Save tarynsauer/a75e1449efe055ebb8be to your computer and use it in GitHub Desktop.
describe ApplicantInteractor do
let(:applicant) { Footprints::Repository.applicant.create( :name => "Bob", :applied_on => Date.current, :email => "test@test.com") }
describe ".update" do
it "updates the applicant" do
params = { :name => "John" }
ApplicantInteractor.new(applicant, params).update
expect(applicant.name).to eq("John")
end
end
describe ".craftsman_changed?" do
context "craftsman has changed" do
let(:craftsman) { Footprints::Repository.craftsman.create(:name => "A Craftsman", :doppler_id => "007", :email => "acraftsman@example.com") }
let(:bcraftsman) { Footprints::Repository.craftsman.create(:name => "B Craftsman", :doppler_id => "008", :email => "bcraftsman@example.com") }
it "recognizes that assigned craftsman has changed" do
applicant.assigned_craftsman = "B Craftsman"
interactor = ApplicantInteractor.new(applicant, :assigned_craftsman => "A Craftsman")
expect(interactor.craftsman_changed?).to be_true
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment