mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-09 08:47:11 -05:00
Fix some tests
This commit is contained in:
parent
e1f16c98a2
commit
c462d34efa
2 changed files with 5 additions and 4 deletions
|
|
@ -12,10 +12,11 @@ class Place < ApplicationRecord
|
|||
has_many :place_visits, dependent: :destroy
|
||||
has_many :suggested_visits, -> { distinct }, through: :place_visits, source: :visit
|
||||
|
||||
before_validation :build_lonlat, if: -> { latitude.present? && longitude.present? }
|
||||
|
||||
validates :name, presence: true
|
||||
validates :latitude, :longitude, presence: true
|
||||
|
||||
before_validation :build_lonlat, if: -> { latitude.present? && longitude.present? }
|
||||
validates :lonlat, presence: true
|
||||
|
||||
enum :source, { manual: 0, photon: 1 }
|
||||
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@ RSpec.describe Place, type: :model do
|
|||
|
||||
describe '#lon' do
|
||||
it 'returns the longitude' do
|
||||
expect(place.lon).to eq(13.0948638)
|
||||
expect(place.lon).to be_within(0.000001).of(13.0948638)
|
||||
end
|
||||
end
|
||||
|
||||
describe '#lat' do
|
||||
it 'returns the latitude' do
|
||||
expect(place.lat).to eq(54.2905245)
|
||||
expect(place.lat).to be_within(0.000001).of(54.2905245)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue