Created
June 3, 2018 04:10
-
-
Save chelseatroy/03806e80f0d5342bc2af6a9e0c322328 to your computer and use it in GitHub Desktop.
Switching Data Sources: Repository Unit Test
This file contains hidden or 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
require 'rails_helper' | |
RSpec.describe Repositories::ReceiptDataSource do | |
describe "get_receipts" do | |
before do | |
Receipt.delete_all | |
end | |
it "gets all receipts" do | |
@subject_under_test = Repositories::ReceiptDataSource.new | |
FactoryGirl.create(:receipt) | |
FactoryGirl.create(:receipt) | |
#This is an example, but you could do any number and combination of assertions here | |
expect(@subject_under_test.get_receipts.length).to eq(2) | |
expect(@subject_under_test.get_receipts.first).to be_instance_of(Receipt) | |
end | |
... | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment