Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Applying Clean Architecture: Repository Interfaces
RSpec.shared_examples "Business Profiles Repository Interface" do
describe "instance methods" do
it { is_expected.to respond_to :find }
it { is_expected.to respond_to :update }
end
describe "#find" do
let(:invalid_result) { subject.find invalid_id }
it "return a Nav::Entities::BusinessProfile" do
expect(subject.find valid_id).to be_a(Nav::Entities::BusinessProfile)
expect(subject.find invalid_id).to be_a(Nav::Entities::BusinessProfile)
end
it "adds error message when unsuccessful" do
expect(invalid_result.errors).to include("can not find Business Profile with ID #{invalid_id}")
end
end
describe "#update" do
it "return a Nav::Entities::BusinessProfile" do
expect(subject.update for_id: valid_id).to be_a(Nav::Entities::BusinessProfile)
expect(subject.update for_id: invalid_id).to be_a(Nav::Entities::BusinessProfile)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.