mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-09 18:28:10 -05:00
Fix params deep_symbolize_keys in OwnTracks::Params
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
DATABASE_HOST=dawarich_db
|
||||
DATABASE_HOST=localhost
|
||||
DATABASE_USERNAME=postgres
|
||||
DATABASE_PASSWORD=password
|
||||
DATABASE_NAME=dawarich_test
|
||||
|
||||
@@ -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 }
|
||||
|
||||
@@ -4,7 +4,7 @@ class OwnTracks::Params
|
||||
attr_reader :params
|
||||
|
||||
def initialize(params)
|
||||
@params = params.deep_symbolize_keys
|
||||
@params = params
|
||||
end
|
||||
|
||||
def call
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user