Sha256: 752d92621895b996637b1e0d9d3cacb46b85d615429bb249ebd4fe1afaa9fbce

Contents?: true

Size: 1.17 KB

Versions: 16

Compression:

Stored size: 1.17 KB

Contents

require 'rails_helper'

RSpec.describe UserLocation, type: :model do
  include LocationHelper
  before :all do
    create_test_airport
  end

  let(:user) { User.make! }

  it "validates the detectable type" do
    ul = UserLocation.new(user: user, location: Location.last, detectable: Location.last, coords: rand_coords)
    ul.valid?.should == false
    ul.errors[:detectable_type].should == ["is not included in the list"]
  end

  it "logs a user's locations by beacon" do
    beacon = LocationBeacon.last
    user.user_locations.build(location: beacon.location, detectable: beacon, coords: rand_coords)
    user.save.should == true
    p2 = user.user_locations.build(location: beacon.location, detectable: beacon, coords: rand_coords)
    user.save.should == true
    user.user_locations.first.should == p2
  end

  it "logs a user's beacon location by gps" do
    gps = LocationGps.last
    user.user_locations.build(location: gps.location, detectable: gps, coords: rand_coords)
    user.save.should == true
    p2 = user.user_locations.build(location: gps.location, detectable: gps, coords: rand_coords)
    user.save.should == true
    user.user_locations.first.should == p2
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
introspective_grape-0.6.1 spec/models/user_location_spec.rb
introspective_grape-0.5.7 spec/models/user_location_spec.rb
introspective_grape-0.5.6 spec/models/user_location_spec.rb
introspective_grape-0.5.5 spec/models/user_location_spec.rb
introspective_grape-0.5.4 spec/models/user_location_spec.rb
introspective_grape-0.5.2 spec/models/user_location_spec.rb
introspective_grape-0.5.0 spec/models/user_location_spec.rb
introspective_grape-0.4.3 spec/models/user_location_spec.rb
introspective_grape-0.4.2 spec/models/user_location_spec.rb
introspective_grape-0.4.1 spec/models/user_location_spec.rb
introspective_grape-0.4.0 spec/models/user_location_spec.rb
introspective_grape-0.3.9 spec/models/user_location_spec.rb
introspective_grape-0.3.7 spec/models/user_location_spec.rb
introspective_grape-0.3.6 spec/models/user_location_spec.rb
introspective_grape-0.3.5 spec/models/user_location_spec.rb
introspective_grape-0.3.3 spec/models/user_location_spec.rb