-
Notifications
You must be signed in to change notification settings - Fork 245
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from geokit/tests2023
Tests 2023
- Loading branch information
Showing
55 changed files
with
893 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module GeokitRails | ||
VERSION = "2.4.0.pre" | ||
VERSION = "2.5.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative "config/application" | ||
|
||
Rails.application.load_tasks |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/* Application styles */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Channel < ActionCable::Channel::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module ApplicationCable | ||
class Connection < ActionCable::Connection::Base | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ApplicationController < ActionController::Base | ||
attr_accessor :remote_ip | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
class LocationAwareController < ApplicationController #:nodoc: all | ||
before_action :set_ip, only: [:index,:cookietest,:sessiontest] | ||
before_action :set_ip_bad, only: [:failtest] | ||
before_action :setup, only: [:cookietest,:sessiontest] | ||
geocode_ip_address | ||
|
||
def index | ||
render plain: '' | ||
end | ||
|
||
def cookietest | ||
cookies[:geo_location] = @success.to_json | ||
render plain: '' | ||
end | ||
|
||
def sessiontest | ||
session[:geo_location] = @success.to_json | ||
render plain: '' | ||
end | ||
|
||
def failtest | ||
render plain: '' | ||
end | ||
|
||
def rescue_action(e) raise e end; | ||
private | ||
def set_ip | ||
request.remote_ip = "good ip" | ||
end | ||
def set_ip_bad | ||
request.remote_ip = "bad ip" | ||
end | ||
def setup | ||
@success = Geokit::GeoLoc.new | ||
@success.provider = "hostip" | ||
@success.lat = 41.7696 | ||
@success.lng = -88.4588 | ||
@success.city = "Sugar Grove" | ||
@success.state = "IL" | ||
@success.country_code = "US" | ||
@success.success = true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class ApplicationJob < ActiveJob::Base | ||
# Automatically retry jobs that encountered a deadlock | ||
# retry_on ActiveRecord::Deadlocked | ||
|
||
# Most jobs are safe to ignore if the underlying records are no longer available | ||
# discard_on ActiveJob::DeserializationError | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ApplicationMailer < ActionMailer::Base | ||
default from: "from@example.com" | ||
layout "mailer" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class ApplicationRecord < ActiveRecord::Base | ||
primary_abstract_class | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>Dummy</title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
<%= stylesheet_link_tag "application" %> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<style> | ||
/* Email styles need to be inline */ | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= yield %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
APP_PATH = File.expand_path("../config/application", __dir__) | ||
require_relative "../config/boot" | ||
require "rails/commands" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env ruby | ||
require_relative "../config/boot" | ||
require "rake" | ||
Rake.application.run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env ruby | ||
require "fileutils" | ||
|
||
# path to your application root. | ||
APP_ROOT = File.expand_path("..", __dir__) | ||
|
||
def system!(*args) | ||
system(*args) || abort("\n== Command #{args} failed ==") | ||
end | ||
|
||
FileUtils.chdir APP_ROOT do | ||
# This script is a way to set up or update your development environment automatically. | ||
# This script is idempotent, so that you can run it at any time and get an expectable outcome. | ||
# Add necessary setup steps to this file. | ||
|
||
puts "== Installing dependencies ==" | ||
system! "gem install bundler --conservative" | ||
system("bundle check") || system!("bundle install") | ||
|
||
# puts "\n== Copying sample files ==" | ||
# unless File.exist?("config/database.yml") | ||
# FileUtils.cp "config/database.yml.sample", "config/database.yml" | ||
# end | ||
|
||
puts "\n== Preparing database ==" | ||
system! "bin/rails db:prepare" | ||
|
||
puts "\n== Removing old logs and tempfiles ==" | ||
system! "bin/rails log:clear tmp:clear" | ||
|
||
puts "\n== Restarting application server ==" | ||
system! "bin/rails restart" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# This file is used by Rack-based servers to start the application. | ||
|
||
require_relative "config/environment" | ||
|
||
run Rails.application | ||
Rails.application.load_server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
require_relative "boot" | ||
|
||
require "rails/all" | ||
|
||
# Require the gems listed in Gemfile, including any gems | ||
# you've limited to :test, :development, or :production. | ||
Bundler.require(*Rails.groups) | ||
require "geokit-rails" | ||
|
||
module Dummy | ||
class Application < Rails::Application | ||
config.load_defaults Rails::VERSION::STRING.to_f | ||
|
||
# Configuration for the application, engines, and railties goes here. | ||
# | ||
# These settings can be overridden in specific environments using the files | ||
# in config/environments, which are processed later. | ||
# | ||
# config.time_zone = "Central Time (US & Canada)" | ||
# config.eager_load_paths << Rails.root.join("extras") | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Set up gems listed in the Gemfile. | ||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../../Gemfile", __dir__) | ||
|
||
require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"]) | ||
$LOAD_PATH.unshift File.expand_path("../../../lib", __dir__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
development: | ||
adapter: async | ||
|
||
test: | ||
adapter: test | ||
|
||
production: | ||
adapter: redis | ||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> | ||
channel_prefix: dummy_production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# SQLite. Versions 3.8.0 and up are supported. | ||
# gem install sqlite3 | ||
# | ||
# Ensure the SQLite 3 gem is defined in your Gemfile | ||
# gem "sqlite3" | ||
# | ||
default: &default | ||
adapter: sqlite3 | ||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> | ||
timeout: 5000 | ||
|
||
development: | ||
<<: *default | ||
database: db/development.sqlite3 | ||
|
||
# Warning: The database defined as "test" will be erased and | ||
# re-generated from your development database when you run "rake". | ||
# Do not set this db to the same as development or production. | ||
test: | ||
<<: *default | ||
database: db/test.sqlite3 | ||
|
||
production: | ||
<<: *default | ||
database: db/production.sqlite3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Load the Rails application. | ||
require_relative "application" | ||
|
||
# Initialize the Rails application. | ||
Rails.application.initialize! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
require "active_support/core_ext/integer/time" | ||
|
||
Rails.application.configure do | ||
# Settings specified here will take precedence over those in config/application.rb. | ||
|
||
# In the development environment your application's code is reloaded any time | ||
# it changes. This slows down response time but is perfect for development | ||
# since you don't have to restart the web server when you make code changes. | ||
config.cache_classes = false | ||
|
||
# Do not eager load code on boot. | ||
config.eager_load = false | ||
|
||
# Show full error reports. | ||
config.consider_all_requests_local = true | ||
|
||
# Enable server timing | ||
config.server_timing = true | ||
|
||
# Enable/disable caching. By default caching is disabled. | ||
# Run rails dev:cache to toggle caching. | ||
if Rails.root.join("tmp/caching-dev.txt").exist? | ||
config.action_controller.perform_caching = true | ||
config.action_controller.enable_fragment_cache_logging = true | ||
|
||
config.cache_store = :memory_store | ||
config.public_file_server.headers = { | ||
"Cache-Control" => "public, max-age=#{2.days.to_i}" | ||
} | ||
else | ||
config.action_controller.perform_caching = false | ||
|
||
config.cache_store = :null_store | ||
end | ||
|
||
# Store uploaded files on the local file system (see config/storage.yml for options). | ||
config.active_storage.service = :local | ||
|
||
# Don't care if the mailer can't send. | ||
config.action_mailer.raise_delivery_errors = false | ||
|
||
config.action_mailer.perform_caching = false | ||
|
||
# Print deprecation notices to the Rails logger. | ||
config.active_support.deprecation = :log | ||
|
||
# Raise exceptions for disallowed deprecations. | ||
config.active_support.disallowed_deprecation = :raise | ||
|
||
# Tell Active Support which deprecation messages to disallow. | ||
config.active_support.disallowed_deprecation_warnings = [] | ||
|
||
# Raise an error on page load if there are pending migrations. | ||
config.active_record.migration_error = :page_load | ||
|
||
# Highlight code that triggered database queries in logs. | ||
config.active_record.verbose_query_logs = true | ||
|
||
|
||
# Raises error for missing translations. | ||
# config.i18n.raise_on_missing_translations = true | ||
|
||
# Annotate rendered view with file names. | ||
# config.action_view.annotate_rendered_view_with_filenames = true | ||
|
||
# Uncomment if you wish to allow Action Cable access from any origin. | ||
# config.action_cable.disable_request_forgery_protection = true | ||
end |
Oops, something went wrong.