Created
December 1, 2017 21:11
-
-
Save plainprogrammer/4390585607fbcc070c06bb084b855cdb to your computer and use it in GitHub Desktop.
Applying Clean Architecture: Repository Interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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