Sha256: 77518e0d4e2c4c0b3cccfc704bd5ef35946a12bade35d042d32860cee66d7c47

Contents?: true

Size: 912 Bytes

Versions: 5

Compression:

Stored size: 912 Bytes

Contents

shared_examples 'Unidom::Geo::Concerns::AsLocated' do |model_attributes, location, locator|

  context do

    locating_1_attribtues = {
        location_id:  SecureRandom.uuid,
        locator_id:   SecureRandom.uuid,
        locator_type: 'Unidom::Geo::Locator::Mock'
      }

    locating_2_attribtues = {
        location_id:  SecureRandom.uuid,
        locator_id:   SecureRandom.uuid,
        locator_type: 'Unidom::Geo::Locator::Mock'
      }

    it_behaves_like 'has_many', model_attributes, :locatings, Unidom::Geo::Locating, [ locating_1_attribtues, locating_2_attribtues ]

    located = described_class.create! model_attributes

    it_behaves_like 'assert_present!', located, :is_located!, [ { to: location, by: locator, at: Time.now } ], [ :to, :by, :at ]
    it_behaves_like 'assert_present!', located, :is_located?, [ { to: location,              at: Time.now } ], [ :to,      :at ]

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unidom-geo-2.0.1 lib/rspec/models/unidom/geo/concerns/as_located_shared_examples.rb
unidom-geo-2.0 lib/rspec/models/unidom/geo/concerns/as_located_shared_examples.rb
unidom-geo-1.5.9 lib/rspec/models/unidom/geo/concerns/as_located_shared_examples.rb
unidom-geo-1.5.8 lib/rspec/models/unidom/geo/concerns/as_located_shared_examples.rb
unidom-geo-1.5.7 lib/rspec/models/unidom/geo/concerns/as_located_shared_examples.rb