Fix params deep_symbolize_keys in OwnTracks::Params

This commit is contained in:
Eugene Burmakin
2024-03-16 00:01:00 +01:00
parent bb1f82076a
commit e2095bae9c
6 changed files with 26 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
DATABASE_HOST=dawarich_db
DATABASE_HOST=localhost
DATABASE_USERNAME=postgres
DATABASE_PASSWORD=password
DATABASE_NAME=dawarich_test

View File

@@ -1,5 +1,5 @@
class Import < ApplicationRecord
belongs_to :user, dependent: :destroy
belongs_to :user
has_many :points, dependent: :destroy
enum source: { google: 0, owntracks: 1 }

View File

@@ -4,7 +4,7 @@ class OwnTracks::Params
attr_reader :params
def initialize(params)
@params = params.deep_symbolize_keys
@params = params
end
def call

View File

@@ -1,5 +1,8 @@
require 'rails_helper'
RSpec.describe Import, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
describe 'associations' do
it { is_expected.to have_many(:points).dependent(:destroy) }
it { is_expected.to belong_to(:user) }
end
end

View File

@@ -2,7 +2,7 @@ require 'rails_helper'
RSpec.describe Point, type: :model do
describe 'associations' do
it { is_expected.to belong_to(:tracker).optional }
it { is_expected.to belong_to(:import).optional }
end
describe 'validations' do

View File

@@ -2,10 +2,24 @@ require 'rails_helper'
RSpec.describe "Points", type: :request do
describe "GET /index" do
it "returns http success" do
get "/points/index"
expect(response).to have_http_status(:success)
context 'when user signed in' do
before do
sign_in create(:user)
end
it "returns http success" do
get points_path
expect(response).to have_http_status(:success)
end
end
context 'when user not signed in' do
it "returns http success" do
get points_path
expect(response).to have_http_status(302)
end
end
end
end