spec/integration/singleton_spec.rb in maestrano-connector-rails-1.0.0 vs spec/integration/singleton_spec.rb in maestrano-connector-rails-1.0.1

- old
+ new

@@ -51,19 +51,19 @@ let(:connec_updated) { 1.hour.ago } let(:ext_updated) { 1.hour.ago } let(:company_base) { { "name" => "My awesome company", - "updated_at" => connec_updated + "updated_at" => connec_updated.iso8601 } } let(:ext_company_base) { { 'id' => ext_comp_id, 'name' => 'My not so awesome store', - 'updated_at' => ext_updated + 'updated_at' => ext_updated.iso8601 } } let(:mapped_connec_entity) { { @@ -97,11 +97,11 @@ describe 'when no idmap' do describe 'when received both' do - let(:company) { [company_base.merge('id' => [{'id' => 'some connec id', 'provider' => 'connec', 'realm' => organization.uid}])] } + let(:company) { company_base.merge('id' => [{'id' => 'some connec id', 'provider' => 'connec', 'realm' => organization.uid}]) } let(:ext_company) { [ext_company_base] } context 'when connec most recent' do let(:connec_updated) { 1.second.ago } let(:batch_params) { @@ -125,10 +125,15 @@ } ] } } + it 'handles the get correctly' do + expect_any_instance_of(Entities::SingletonIntegration).to receive(:consolidate_and_map_data).with([company], ext_company).and_return({connec_entities: [], external_entities: []}) + subject + end + it 'handles the idmap correctly' do expect{ subject }.to change{ Maestrano::Connector::Rails::IdMap.count }.by(1) idmap = Maestrano::Connector::Rails::IdMap.last @@ -180,11 +185,11 @@ describe 'when idmap exists' do describe 'when received both' do - let(:company) { [company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}])] } + let(:company) { company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}]) } let(:ext_company) { [ext_company_base] } let!(:idmap) { Entities::SingletonIntegration.create_idmap(organization_id: organization.id, external_id: ext_comp_id) } context 'when connec most recent' do let(:connec_updated) { 1.second.ago } @@ -239,10 +244,10 @@ end end end describe 'when received only connec one' do - let(:company) { [company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}])] } + let(:company) { company_base.merge('id' => [{'id' => ext_comp_id, 'provider' => provider, 'realm' => oauth_uid}, {'id' => 'connec-id', 'provider' => 'connec', 'realm' => 'some-realm'}]) } let(:ext_company) { [] } let!(:idmap) { Entities::SingletonIntegration.create_idmap(organization_id: organization.id, external_id: ext_comp_id) } it 'handles the idmap correctly' do expect{