lib/rspec/models/unidom/geo/location_spec.rb in unidom-geo-1.5.2 vs lib/rspec/models/unidom/geo/location_spec.rb in unidom-geo-1.5.3
- old
+ new
@@ -202,9 +202,25 @@
{ postal_code: 'AAA' } => 0,
{ postal_code: 'A'*(postal_code_max_length-1) } => 0,
{ postal_code: 'A'*postal_code_max_length } => 0,
{ postal_code: 'A'*(postal_code_max_length+1) } => 1
+ locating_1_attributes = {
+ located_id: SecureRandom.uuid,
+ located_type: 'Unidom::Geo::Located::Mock',
+ locator_id: SecureRandom.uuid,
+ locator_type: 'Unidom::Geo::Locator::Mock'
+ }
+
+ locating_2_attributes = {
+ located_id: SecureRandom.uuid,
+ located_type: 'Unidom::Geo::Located::Mock',
+ locator_id: SecureRandom.uuid,
+ locator_type: 'Unidom::Geo::Locator::Mock'
+ }
+
+ it_behaves_like 'has_many', model_attributes, :locatings, Unidom::Geo::Locating, [ locating_1_attributes, locating_2_attributes ]
+
it_behaves_like 'scope', :postal_address_is, [
{ attributes_collection: [ model_attributes ], count_diff: 1, args: [ 'Somewhere' ] },
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ 'Somewhere1' ] },
{ attributes_collection: [ model_attributes ], count_diff: 0, args: [ 'somewhere' ] } ]