|
| 1 | +# frozen_string_literal: true |
| 2 | + |
| 3 | +require 'spec_helper' |
| 4 | + |
| 5 | +# This spec verifies Webmock is intercepting network API calls |
| 6 | +RSpec.describe EventSource do |
| 7 | + it 'queries an outside source' do |
| 8 | + uri = |
| 9 | + URI('https://api.github.com/repos/thoughtbot/factory_girl/contributors') |
| 10 | + |
| 11 | + response = Oj.load(Net::HTTP.get(uri)) |
| 12 | + expect(response.first['login']).to eq 'joshuaclayton' |
| 13 | + # expect(response).to be_an_instance_of(String) |
| 14 | + end |
| 15 | +end |
| 16 | + |
| 17 | +# RSpec.describe Parties::Organization::CorrectOrUpdateFein do |
| 18 | +# context 'Call the Organization Create Service and store a record with an incorrect FEIN value' do |
| 19 | +# let(:legal_name) { 'Spacely Sprockets, Inc.' } |
| 20 | +# let(:entity_kind) { :s_corporation } |
| 21 | +# let(:bad_fein) { '111111111' } |
| 22 | +# let(:current_time) { Time.now } |
| 23 | +# let(:metadata) { { created_at: current_time, updated_at: current_time } } |
| 24 | + |
| 25 | +# let(:org_params) do |
| 26 | +# { |
| 27 | +# legal_name: legal_name, |
| 28 | +# entity_kind: entity_kind, |
| 29 | +# fein: bad_fein, |
| 30 | +# metadata: metadata |
| 31 | +# } |
| 32 | +# end |
| 33 | + |
| 34 | +# let!(:event) { Organizations::Create.call(org_params) } |
| 35 | + |
| 36 | +# context 'then with the same Organization, call the UpdateFein Service with the corrected FEIN value' do |
| 37 | +# let(:corrected_fein) { '555555555' } |
| 38 | +# let(:updated_timestamp) { Time.now } |
| 39 | +# let(:updated_event_type) { 'Organizations::FeinUpdated' } |
| 40 | +# let(:organization_class) { 'Organizations::Organization'.constantize } |
| 41 | + |
| 42 | +# subject do |
| 43 | +# described_class.call( |
| 44 | +# organization: event.source_model, |
| 45 | +# fein: corrected_fein, |
| 46 | +# metadata: { |
| 47 | +# created_at: event.source_model.created_at, |
| 48 | +# updated_at: updated_timestamp |
| 49 | +# } |
| 50 | +# ) |
| 51 | +# end |
| 52 | + |
| 53 | +# # it 'should return an Event instance of the correct type' do |
| 54 | +# # expect(subject).to be_a EventSource::EventStream |
| 55 | +# # expect(subject._type).to eq updated_event_type |
| 56 | +# # end |
| 57 | + |
| 58 | +# # it 'the persisted model record should have the corrected FEIN value' do |
| 59 | +# # expect( |
| 60 | +# # organization_class.find(subject.source_model.id).fein |
| 61 | +# # ).to eq corrected_fein |
| 62 | +# # end |
| 63 | + |
| 64 | +# # it 'and the EventStream should have an associated record of the state change' do |
| 65 | +# # events = organization_class.find(subject.source_model.id).events |
| 66 | +# # expect(events.size).to eq 2 |
| 67 | +# # expect(events.last.fein).to eq corrected_fein |
| 68 | +# # end |
| 69 | +# end |
| 70 | +# end |
| 71 | +# end |
0 commit comments