tests: add user events controller tests.

This commit is contained in:
evazion
2021-01-12 18:53:02 -06:00
parent 7537edb211
commit b72d249ee3
6 changed files with 95 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
FactoryBot.define do
factory(:ip_geolocation) do
ip_addr { FFaker::Internet.ip_v4_address }
network { FFaker::Internet.ip_v4_address }
asn { 42 }
organization { "AT&T" }
carrier { "AT&T" }
is_proxy { false }
latitude { 50.0 }
longitude { 50.0 }
time_zone { FFaker::Address.time_zone }
continent { "NA" }
country { "US" }
region { FFaker::AddressUS.state_abbr }
city { FFaker::AddressUS.city }
end
end

View File

@@ -1,5 +1,6 @@
FactoryBot.define do
factory(:user_event) do
user
user_session
end
end

View File

@@ -0,0 +1,7 @@
FactoryBot.define do
factory(:user_session) do
ip_addr { create(:ip_geolocation).ip_addr }
session_id { SecureRandom.hex(32) }
user_agent { "Mozilla/5.0" }
end
end