├── log
└── .keep
├── storage
└── .keep
├── tmp
├── .keep
├── pids
│ └── .keep
└── storage
│ └── .keep
├── vendor
├── .keep
└── javascript
│ └── .keep
├── assetsprecompile
├── lib
├── assets
│ └── .keep
└── tasks
│ └── .keep
├── public
├── favicon.ico
├── apple-touch-icon.png
├── apple-touch-icon-precomposed.png
├── robots.txt
├── 500.html
├── 422.html
└── 404.html
├── test
├── helpers
│ └── .keep
├── mailers
│ └── .keep
├── models
│ └── .keep
├── system
│ └── .keep
├── controllers
│ └── .keep
├── integration
│ └── .keep
├── fixtures
│ └── files
│ │ └── .keep
├── application_system_test_case.rb
├── channels
│ └── application_cable
│ │ └── connection_test.rb
└── test_helper.rb
├── app
├── assets
│ ├── images
│ │ └── .keep
│ ├── config
│ │ └── manifest.js
│ ├── javascripts
│ │ └── main.js
│ └── stylesheets
│ │ └── application.css
├── models
│ ├── concerns
│ │ └── .keep
│ ├── application_record.rb
│ └── search_query.rb
├── controllers
│ ├── concerns
│ │ └── .keep
│ ├── application_controller.rb
│ └── api
│ │ └── v1
│ │ └── search_queries_controller.rb
├── views
│ ├── layouts
│ │ ├── mailer.text.erb
│ │ ├── mailer.html.erb
│ │ └── application.html.erb
│ └── search_queries
│ │ └── index.html.erb
├── helpers
│ ├── application_helper.rb
│ └── search_queries_helper.rb
├── channels
│ └── application_cable
│ │ ├── channel.rb
│ │ └── connection.rb
├── mailers
│ └── application_mailer.rb
├── javascript
│ ├── application.js
│ └── controllers
│ │ ├── hello_controller.js
│ │ ├── application.js
│ │ └── index.js
└── jobs
│ └── application_job.rb
├── .ruby-version
├── bin
├── rake
├── importmap
├── render-build.sh
├── rails
├── setup
├── bundle
└── bundle.cmd
├── config
├── environment.rb
├── boot.rb
├── cable.yml
├── initializers
│ ├── cors.rb
│ ├── filter_parameter_logging.rb
│ ├── permissions_policy.rb
│ ├── assets.rb
│ ├── inflections.rb
│ └── content_security_policy.rb
├── importmap.rb
├── routes.rb
├── credentials.yml.enc
├── application.rb
├── locales
│ └── en.yml
├── storage.yml
├── puma.rb
├── environments
│ ├── test.rb
│ ├── development.rb
│ └── production.rb
└── database.yml
├── spec
├── requests
│ └── search_queries_spec.rb
├── models
│ └── search_query_spec.rb
├── helpers
│ └── search_queries_helper_spec.rb
├── rails_helper.rb
└── spec_helper.rb
├── config.ru
├── package.json
├── Rakefile
├── .gitattributes
├── db
├── migrate
│ └── 20240110131049_create_search_queries.rb
├── seeds.rb
└── schema.rb
├── render.yaml
├── .gitignore
├── .rubocop.yml
├── .github
└── workflows
│ └── linters.yml
├── Gemfile
├── README.md
└── Gemfile.lock
/log/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/storage/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tmp/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/assetsprecompile:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/assets/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/lib/tasks/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/helpers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/mailers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/models/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/system/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tmp/pids/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/tmp/storage/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/assets/images/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/controllers/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/integration/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/vendor/javascript/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/.ruby-version:
--------------------------------------------------------------------------------
1 | ruby-3.2.2
2 |
--------------------------------------------------------------------------------
/app/models/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/apple-touch-icon.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/test/fixtures/files/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/controllers/concerns/.keep:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/public/apple-touch-icon-precomposed.png:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.text.erb:
--------------------------------------------------------------------------------
1 | <%= yield %>
2 |
--------------------------------------------------------------------------------
/app/helpers/application_helper.rb:
--------------------------------------------------------------------------------
1 | module ApplicationHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/helpers/search_queries_helper.rb:
--------------------------------------------------------------------------------
1 | module SearchQueriesHelper
2 | end
3 |
--------------------------------------------------------------------------------
/app/controllers/application_controller.rb:
--------------------------------------------------------------------------------
1 | class ApplicationController < ActionController::Base
2 | end
3 |
--------------------------------------------------------------------------------
/app/models/application_record.rb:
--------------------------------------------------------------------------------
1 | class ApplicationRecord < ActiveRecord::Base
2 | primary_abstract_class
3 | end
4 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require_relative "../config/boot"
3 | require "rake"
4 | Rake.application.run
5 |
--------------------------------------------------------------------------------
/app/models/search_query.rb:
--------------------------------------------------------------------------------
1 | class SearchQuery < ApplicationRecord
2 | validates :query, :ip, presence: true
3 | end
4 |
--------------------------------------------------------------------------------
/bin/importmap:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | require_relative "../config/application"
4 | require "importmap/commands"
5 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 |
--------------------------------------------------------------------------------
/app/channels/application_cable/channel.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Channel < ActionCable::Channel::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/channels/application_cable/connection.rb:
--------------------------------------------------------------------------------
1 | module ApplicationCable
2 | class Connection < ActionCable::Connection::Base
3 | end
4 | end
5 |
--------------------------------------------------------------------------------
/app/mailers/application_mailer.rb:
--------------------------------------------------------------------------------
1 | class ApplicationMailer < ActionMailer::Base
2 | default from: "from@example.com"
3 | layout "mailer"
4 | end
5 |
--------------------------------------------------------------------------------
/bin/render-build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | # exit on error
3 | set -o errexit
4 |
5 | bundle install
6 | ./bin/rails assets:precompile
7 | ./bin/rails assets:clean
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | APP_PATH = File.expand_path("../config/application", __dir__)
3 | require_relative "../config/boot"
4 | require "rails/commands"
5 |
--------------------------------------------------------------------------------
/config/environment.rb:
--------------------------------------------------------------------------------
1 | # Load the Rails application.
2 | require_relative "application"
3 |
4 | # Initialize the Rails application.
5 | Rails.application.initialize!
6 |
--------------------------------------------------------------------------------
/spec/requests/search_queries_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe "SearchQueries", type: :request do
4 | describe "GET /index" do
5 |
6 | end
7 | end
8 |
--------------------------------------------------------------------------------
/app/assets/config/manifest.js:
--------------------------------------------------------------------------------
1 | //= link_tree ../images
2 | //= link_directory ../stylesheets .css
3 | //= link_tree ../../javascript .js
4 | //= link_tree ../../../vendor/javascript .js
5 |
--------------------------------------------------------------------------------
/config.ru:
--------------------------------------------------------------------------------
1 | # This file is used by Rack-based servers to start the application.
2 |
3 | require_relative "config/environment"
4 |
5 | run Rails.application
6 | Rails.application.load_server
7 |
--------------------------------------------------------------------------------
/app/javascript/application.js:
--------------------------------------------------------------------------------
1 | // Configure your import map in config/importmap.rb. Read more: https://github.com/rails/importmap-rails
2 | import "@hotwired/turbo-rails"
3 | import "controllers"
4 |
--------------------------------------------------------------------------------
/test/application_system_test_case.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
4 | driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
5 | end
6 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "devDependencies": {
3 | "stylelint": "^13.13.1",
4 | "stylelint-config-standard": "^21.0.0",
5 | "stylelint-csstree-validator": "^1.9.0",
6 | "stylelint-scss": "^3.21.0"
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/app/javascript/controllers/hello_controller.js:
--------------------------------------------------------------------------------
1 | import { Controller } from "@hotwired/stimulus"
2 |
3 | export default class extends Controller {
4 | connect() {
5 | this.element.textContent = "Hello World!"
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/config/boot.rb:
--------------------------------------------------------------------------------
1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
2 |
3 | require "bundler/setup" # Set up gems listed in the Gemfile.
4 | require "bootsnap/setup" # Speed up boot time by caching expensive operations.
5 |
--------------------------------------------------------------------------------
/app/assets/javascripts/main.js:
--------------------------------------------------------------------------------
1 | document.addEventListener('DOMContentLoaded', function() {
2 | const greeting = document.createElement('p');
3 | greeting.textContent = 'Hello from Vanilla JS!';
4 | document.body.appendChild(greeting);
5 | });
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: test
6 |
7 | production:
8 | adapter: redis
9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10 | channel_prefix: SearchOpt_production
11 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative "config/application"
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2 |
3 | # Mark the database schema as having been generated.
4 | db/schema.rb linguist-generated
5 |
6 | # Mark any vendored files as having been vendored.
7 | vendor/* linguist-vendored
8 |
--------------------------------------------------------------------------------
/db/migrate/20240110131049_create_search_queries.rb:
--------------------------------------------------------------------------------
1 | class CreateSearchQueries < ActiveRecord::Migration[7.0]
2 | def change
3 | create_table :search_queries do |t|
4 | t.string :query
5 | t.string :ip
6 |
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/app/javascript/controllers/application.js:
--------------------------------------------------------------------------------
1 | import { Application } from "@hotwired/stimulus"
2 |
3 | const application = Application.start()
4 |
5 | // Configure Stimulus development experience
6 | application.debug = false
7 | window.Stimulus = application
8 |
9 | export { application }
10 |
--------------------------------------------------------------------------------
/config/initializers/cors.rb:
--------------------------------------------------------------------------------
1 |
2 | Rails.application.config.middleware.insert_before 0, Rack::Cors do
3 | allow do
4 | origins "*"
5 |
6 | resource "*",
7 | headers: :any,
8 | methods: [:get, :post, :put, :patch, :delete, :options, :head]
9 | end
10 |
11 | end
--------------------------------------------------------------------------------
/app/jobs/application_job.rb:
--------------------------------------------------------------------------------
1 | class ApplicationJob < ActiveJob::Base
2 | # Automatically retry jobs that encountered a deadlock
3 | # retry_on ActiveRecord::Deadlocked
4 |
5 | # Most jobs are safe to ignore if the underlying records are no longer available
6 | # discard_on ActiveJob::DeserializationError
7 | end
8 |
--------------------------------------------------------------------------------
/app/views/layouts/mailer.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
10 |
11 | <%= yield %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/test/channels/application_cable/connection_test.rb:
--------------------------------------------------------------------------------
1 | require "test_helper"
2 |
3 | class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
4 | # test "connects with cookies" do
5 | # cookies.signed[:user_id] = 42
6 | #
7 | # connect
8 | #
9 | # assert_equal connection.user_id, "42"
10 | # end
11 | end
12 |
--------------------------------------------------------------------------------
/config/importmap.rb:
--------------------------------------------------------------------------------
1 | # Pin npm packages by running ./bin/importmap
2 |
3 | pin "application", preload: true
4 | pin "@hotwired/turbo-rails", to: "turbo.min.js", preload: true
5 | pin "@hotwired/stimulus", to: "stimulus.min.js", preload: true
6 | pin "@hotwired/stimulus-loading", to: "stimulus-loading.js", preload: true
7 | pin_all_from "app/javascript/controllers", under: "controllers"
8 |
--------------------------------------------------------------------------------
/app/views/search_queries/index.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Your App Name
8 |
9 |
10 | Hello Rails
11 | <%= javascript_include_tag 'main' %>
12 |
13 |
14 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
7 | # Character.create(name: "Luke", movie: movies.first)
8 |
--------------------------------------------------------------------------------
/config/routes.rb:
--------------------------------------------------------------------------------
1 | Rails.application.routes.draw do
2 | # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html
3 |
4 | # Defines the root path route ("/")
5 | namespace :api, defaults: { format: :json } do
6 | namespace :v1 do
7 | post '/search', to: 'search_queries#search'
8 | get '/get_suggestions', to: 'search_queries#get_suggestions'
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure parameters to be filtered from the log file. Use this to limit dissemination of
4 | # sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
5 | # notations and behaviors.
6 | Rails.application.config.filter_parameters += [
7 | :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
8 | ]
9 |
--------------------------------------------------------------------------------
/config/initializers/permissions_policy.rb:
--------------------------------------------------------------------------------
1 | # Define an application-wide HTTP permissions policy. For further
2 | # information see https://developers.google.com/web/updates/2018/06/feature-policy
3 | #
4 | # Rails.application.config.permissions_policy do |f|
5 | # f.camera :none
6 | # f.gyroscope :none
7 | # f.microphone :none
8 | # f.usb :none
9 | # f.fullscreen :self
10 | # f.payment :self, "https://secure.example.com"
11 | # end
12 |
--------------------------------------------------------------------------------
/test/test_helper.rb:
--------------------------------------------------------------------------------
1 | ENV["RAILS_ENV"] ||= "test"
2 | require_relative "../config/environment"
3 | require "rails/test_help"
4 |
5 | class ActiveSupport::TestCase
6 | # Run tests in parallel with specified workers
7 | parallelize(workers: :number_of_processors, with: :threads)
8 |
9 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
10 | fixtures :all
11 |
12 | # Add more helper methods to be used by all tests here...
13 | end
14 |
--------------------------------------------------------------------------------
/config/credentials.yml.enc:
--------------------------------------------------------------------------------
1 | VvNjfSXtcVeyPfRc8vUOPnt4gi0cr8FK7CCVK2acR/uAtj/DC/3wzd/M7HromjyLcUQHz45eQWg5VuG2OUKW9ZZLYlNPrKgmGo7gQQHPLtX5qX4Jj/fnHTNNg5EHdK98+Zs9Ia3UrosWmpc3zXQdlyQEy76YHl+r3ZA47ChPV7Ir91DDd7K7CbOH2k0sigYVvhf+1zPl2lLSaTv4Q05c08UsJcBUSFNlfI6twgZ98dl/+xoJ1KSXsWu3tN4nTgGlKQXhBZ8wZNPVQ3SfHPCe/kyRJhvLuiMKdh5XUsyDjolKv6K1eW0KpO4V5RXxsfGU8GSgoN9jjCzGbSu2YItSdiPwjXJSFWsTod5YnfeahsGB4oFur8u2TaI7BmRItsklxC7Yfh0kNEzt04WkWMjMQ7sc4denXZ9/AczM--LLG+RvmOkGU1iEUk--TWw9Y8ZHMuDuXxWaN/Hrrw==
--------------------------------------------------------------------------------
/spec/models/search_query_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | RSpec.describe SearchQuery, type: :model do
4 | before(:each) do
5 | @query = SearchQuery.new(query: 'how', ip: '192.168.1.18')
6 | end
7 |
8 | describe 'Validations' do
9 | it 'query should be present' do
10 | @query.query = ''
11 | expect(@query).to_not be_valid
12 | end
13 | it 'ip should be present' do
14 | @query.ip = ''
15 | expect(@query).to_not be_valid
16 | end
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/helpers/search_queries_helper_spec.rb:
--------------------------------------------------------------------------------
1 | require 'rails_helper'
2 |
3 | # Specs in this file have access to a helper object that includes
4 | # the SearchQueriesHelper. For example:
5 | #
6 | # describe SearchQueriesHelper do
7 | # describe "string concat" do
8 | # it "concats two strings with spaces" do
9 | # expect(helper.concat_strings("this","that")).to eq("this that")
10 | # end
11 | # end
12 | # end
13 | RSpec.describe SearchQueriesHelper, type: :helper do
14 | pending "add some examples to (or delete) #{__FILE__}"
15 | end
16 |
--------------------------------------------------------------------------------
/config/initializers/assets.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Version of your assets, change this if you want to expire all your assets.
4 | Rails.application.config.assets.version = "1.0"
5 |
6 | # Add additional assets to the asset load path.
7 | # Rails.application.config.assets.paths << Emoji.images_path
8 |
9 | # Precompile additional assets.
10 | # application.js, application.css, and all non-JS/CSS in the app/assets
11 | # folder are already added.
12 | # Rails.application.config.assets.precompile += %w( admin.js admin.css )
13 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | SearchOpt
5 |
6 | <%= csrf_meta_tags %>
7 | <%= csp_meta_tag %>
8 |
9 | <%= stylesheet_link_tag "application", "data-turbo-track": "reload" %>
10 | <%= javascript_importmap_tags %>
11 |
12 |
13 |
14 | <%= yield %>
15 | <% flash.each do |key, message| %>
16 |
17 | <%= message %>
18 |
19 | <% end %>
20 |
21 |
22 |
--------------------------------------------------------------------------------
/app/javascript/controllers/index.js:
--------------------------------------------------------------------------------
1 | // Import and register all your controllers from the importmap under controllers/*
2 |
3 | import { application } from "controllers/application"
4 |
5 | // Eager load all controllers defined in the import map under controllers/**/*_controller
6 | import { eagerLoadControllersFrom } from "@hotwired/stimulus-loading"
7 | eagerLoadControllersFrom("controllers", application)
8 |
9 | // Lazy load controllers as they appear in the DOM (remember not to preload controllers in import map!)
10 | // import { lazyLoadControllersFrom } from "@hotwired/stimulus-loading"
11 | // lazyLoadControllersFrom("controllers", application)
12 |
--------------------------------------------------------------------------------
/render.yaml:
--------------------------------------------------------------------------------
1 | databases:
2 | - name: searchopt
3 | databaseName: searchopt
4 | user: zdnahom
5 | plan: free
6 |
7 | services:
8 | - type: web
9 | name: searchopt
10 | runtime: ruby
11 | plan: free
12 | buildCommand: "./bin/render-build.sh"
13 | # preDeployCommand: "./bin/rails db:migrate" # preDeployCommand only available on paid instance types
14 | startCommand: "./bin/rails server"
15 | envVars:
16 | - key: DATABASE_URL
17 | fromDatabase:
18 | name: searchopt
19 | property: connectionString
20 | - key: RAILS_MASTER_KEY
21 | sync: false
22 | - key: WEB_CONCURRENCY
23 | value: 2 # sensible default
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, "\\1en"
8 | # inflect.singular /^(ox)en/i, "\\1"
9 | # inflect.irregular "person", "people"
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym "RESTful"
16 | # end
17 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.css:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6 | * vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
--------------------------------------------------------------------------------
/config/application.rb:
--------------------------------------------------------------------------------
1 | require_relative "boot"
2 |
3 | require "rails/all"
4 |
5 | # Require the gems listed in Gemfile, including any gems
6 | # you've limited to :test, :development, or :production.
7 | Bundler.require(*Rails.groups)
8 |
9 | module SearchOpt
10 | class Application < Rails::Application
11 | # Initialize configuration defaults for originally generated Rails version.
12 | config.load_defaults 7.0
13 |
14 | # Configuration for the application, engines, and railties goes here.
15 | #
16 | # These settings can be overridden in specific environments using the files
17 | # in config/environments, which are processed later.
18 | #
19 | # config.time_zone = "Central Time (US & Canada)"
20 | # config.eager_load_paths << Rails.root.join("extras")
21 | end
22 | end
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2 | #
3 | # If you find yourself ignoring temporary files generated by your text editor
4 | # or operating system, you probably want to add a global ignore instead:
5 | # git config --global core.excludesfile '~/.gitignore_global'
6 |
7 | # Ignore bundler config.
8 | /.bundle
9 |
10 | # Ignore all logfiles and tempfiles.
11 | /log/*
12 | /tmp/*
13 | !/log/.keep
14 | !/tmp/.keep
15 |
16 | # Ignore pidfiles, but keep the directory.
17 | /tmp/pids/*
18 | !/tmp/pids/
19 | !/tmp/pids/.keep
20 |
21 | # Ignore uploaded files in development.
22 | /storage/*
23 | !/storage/.keep
24 | /tmp/storage/*
25 | !/tmp/storage/
26 | !/tmp/storage/.keep
27 |
28 | /public/assets
29 |
30 | # Ignore master key for decrypting credentials and more.
31 | /config/master.key
32 | node_modules/
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t "hello"
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t("hello") %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # The following keys must be escaped otherwise they will not be retrieved by
20 | # the default I18n backend:
21 | #
22 | # true, false, on, off, yes, no
23 | #
24 | # Instead, surround them with single quotes.
25 | #
26 | # en:
27 | # "true": "foo"
28 | #
29 | # To learn more, please read the Rails Internationalization guide
30 | # available at https://guides.rubyonrails.org/i18n.html.
31 |
32 | en:
33 | hello: "Hello world"
34 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby.exe
2 | require "fileutils"
3 |
4 | # path to your application root.
5 | APP_ROOT = File.expand_path("..", __dir__)
6 |
7 | def system!(*args)
8 | system(*args) || abort("\n== Command #{args} failed ==")
9 | end
10 |
11 | FileUtils.chdir APP_ROOT do
12 | # This script is a way to set up or update your development environment automatically.
13 | # This script is idempotent, so that you can run it at any time and get an expectable outcome.
14 | # Add necessary setup steps to this file.
15 |
16 | puts "== Installing dependencies =="
17 | system! "gem install bundler --conservative"
18 | system("bundle check") || system!("bundle install")
19 |
20 | # puts "\n== Copying sample files =="
21 | # unless File.exist?("config/database.yml")
22 | # FileUtils.cp "config/database.yml.sample", "config/database.yml"
23 | # end
24 |
25 | puts "\n== Preparing database =="
26 | system! "bin/rails db:prepare"
27 |
28 | puts "\n== Removing old logs and tempfiles =="
29 | system! "bin/rails log:clear tmp:clear"
30 |
31 | puts "\n== Restarting application server =="
32 | system! "bin/rails restart"
33 | end
34 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # This file is the source Rails uses to define your schema when running `bin/rails
6 | # db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
7 | # be faster and is potentially less error prone than running all of your
8 | # migrations from scratch. Old migrations may fail to apply correctly if those
9 | # migrations use external dependencies or application code.
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema[7.0].define(version: 2024_01_10_131049) do
14 | # These are extensions that must be enabled in order to support this database
15 | enable_extension "plpgsql"
16 |
17 | create_table "search_queries", force: :cascade do |t|
18 | t.string "query"
19 | t.string "ip"
20 | t.datetime "created_at", null: false
21 | t.datetime "updated_at", null: false
22 | end
23 |
24 | end
25 |
--------------------------------------------------------------------------------
/config/initializers/content_security_policy.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Define an application-wide content security policy.
4 | # See the Securing Rails Applications Guide for more information:
5 | # https://guides.rubyonrails.org/security.html#content-security-policy-header
6 |
7 | # Rails.application.configure do
8 | # config.content_security_policy do |policy|
9 | # policy.default_src :self, :https
10 | # policy.font_src :self, :https, :data
11 | # policy.img_src :self, :https, :data
12 | # policy.object_src :none
13 | # policy.script_src :self, :https
14 | # policy.style_src :self, :https
15 | # # Specify URI for violation reports
16 | # # policy.report_uri "/csp-violation-report-endpoint"
17 | # end
18 | #
19 | # # Generate session nonces for permitted importmap and inline scripts
20 | # config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
21 | # config.content_security_policy_nonce_directives = %w(script-src)
22 | #
23 | # # Report violations without enforcing the policy.
24 | # # config.content_security_policy_report_only = true
25 | # end
26 |
--------------------------------------------------------------------------------
/app/controllers/api/v1/search_queries_controller.rb:
--------------------------------------------------------------------------------
1 | class Api::V1::SearchQueriesController < ApplicationController
2 | skip_before_action :verify_authenticity_token
3 |
4 | def search
5 | searched = params[:query].to_s.strip
6 | ip = request.remote_ip
7 |
8 | if searched.present?
9 | SearchQuery.create(query: searched, ip: ip)
10 |
11 | render json:{message: "Successfully created"}
12 | else
13 | render json:{error: "Invalid search"}
14 | end
15 | end
16 |
17 | def get_suggestions
18 | partial_input = params[:query].to_s.strip
19 | current_ip = request.remote_ip
20 | user_searches = SearchQuery.where(ip:current_ip).group(:query).count(:query)
21 | if user_searches.present?
22 | suggestions = if partial_input.present?
23 | user_searches.keys.select { |query| query.start_with?(partial_input) }.take(5)
24 | else
25 | user_searches.sort_by { |query, count| -count }.take(5)
26 | end
27 | render json: {suggestions: suggestions}
28 | else
29 | render json: {message: 'No search history'}
30 | end
31 | end
32 | end
--------------------------------------------------------------------------------
/config/storage.yml:
--------------------------------------------------------------------------------
1 | test:
2 | service: Disk
3 | root: <%= Rails.root.join("tmp/storage") %>
4 |
5 | local:
6 | service: Disk
7 | root: <%= Rails.root.join("storage") %>
8 |
9 | # Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
10 | # amazon:
11 | # service: S3
12 | # access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
13 | # secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
14 | # region: us-east-1
15 | # bucket: your_own_bucket-<%= Rails.env %>
16 |
17 | # Remember not to checkin your GCS keyfile to a repository
18 | # google:
19 | # service: GCS
20 | # project: your_project
21 | # credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
22 | # bucket: your_own_bucket-<%= Rails.env %>
23 |
24 | # Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
25 | # microsoft:
26 | # service: AzureStorage
27 | # storage_account_name: your_account_name
28 | # storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
29 | # container: your_container_name-<%= Rails.env %>
30 |
31 | # mirror:
32 | # service: Mirror
33 | # primary: local
34 | # mirrors: [ amazon, google, microsoft ]
35 |
--------------------------------------------------------------------------------
/.rubocop.yml:
--------------------------------------------------------------------------------
1 | AllCops:
2 | NewCops: enable
3 | Exclude:
4 | - "db/**/*"
5 | - "bin/*"
6 | - "config/**/*"
7 | - "Guardfile"
8 | - "Rakefile"
9 | - "node_modules/**/*"
10 |
11 | DisplayCopNames: true
12 |
13 | Layout/LineLength:
14 | Max: 120
15 | Metrics/MethodLength:
16 | Include:
17 | - "app/controllers/*"
18 | - "app/models/*"
19 | Max: 20
20 | Metrics/AbcSize:
21 | Include:
22 | - "app/controllers/*"
23 | - "app/models/*"
24 | Max: 50
25 | Metrics/ClassLength:
26 | Max: 150
27 | Metrics/BlockLength:
28 | AllowedMethods: ['describe']
29 | Max: 30
30 |
31 | Style/Documentation:
32 | Enabled: false
33 | Style/ClassAndModuleChildren:
34 | Enabled: false
35 | Style/EachForSimpleLoop:
36 | Enabled: false
37 | Style/AndOr:
38 | Enabled: false
39 | Style/DefWithParentheses:
40 | Enabled: false
41 | Style/FrozenStringLiteralComment:
42 | EnforcedStyle: never
43 |
44 | Layout/HashAlignment:
45 | EnforcedColonStyle: key
46 | Layout/ExtraSpacing:
47 | AllowForAlignment: false
48 | Layout/MultilineMethodCallIndentation:
49 | Enabled: true
50 | EnforcedStyle: indented
51 | Lint/RaiseException:
52 | Enabled: false
53 | Lint/StructNewOverride:
54 | Enabled: false
55 | Style/HashEachMethods:
56 | Enabled: false
57 | Style/HashTransformKeys:
58 | Enabled: false
59 | Style/HashTransformValues:
60 | Enabled: false
--------------------------------------------------------------------------------
/.github/workflows/linters.yml:
--------------------------------------------------------------------------------
1 | name: Linters
2 |
3 | on: pull_request
4 |
5 | env:
6 | FORCE_COLOR: 1
7 |
8 | jobs:
9 | rubocop:
10 | name: Rubocop
11 | runs-on: ubuntu-22.04
12 | steps:
13 | - uses: actions/checkout@v3
14 | - uses: actions/setup-ruby@v1
15 | with:
16 | ruby-version: 3.1.x
17 | - name: Setup Rubocop
18 | run: |
19 | gem install --no-document rubocop -v '>= 1.0, < 2.0' # https://docs.rubocop.org/en/stable/installation/
20 | [ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.rubocop.yml
21 | - name: Rubocop Report
22 | run: rubocop --color
23 | stylelint:
24 | name: Stylelint
25 | runs-on: ubuntu-22.04
26 | steps:
27 | - uses: actions/checkout@v3
28 | - uses: actions/setup-node@v3
29 | with:
30 | node-version: "18.x"
31 | - name: Setup Stylelint
32 | run: |
33 | npm install --save-dev stylelint@13.x stylelint-scss@3.x stylelint-config-standard@21.x stylelint-csstree-validator@1.x
34 | [ -f .stylelintrc.json ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ror/.stylelintrc.json
35 | - name: Stylelint Report
36 | run: npx stylelint "**/*.{css,scss}"
37 | nodechecker:
38 | name: node_modules checker
39 | runs-on: ubuntu-22.04
40 | steps:
41 | - uses: actions/checkout@v3
42 | - name: Check node_modules existence
43 | run: |
44 | if [ -d "node_modules/" ]; then echo -e "\e[1;31mThe node_modules/ folder was pushed to the repo. Please remove it from the GitHub repository and try again."; echo -e "\e[1;32mYou can set up a .gitignore file with this folder included on it to prevent this from happening in the future." && exit 1; fi
--------------------------------------------------------------------------------
/public/500.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | We're sorry, but something went wrong (500)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
We're sorry, but something went wrong.
62 |
63 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers: a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum; this matches the default thread size of Active Record.
6 | #
7 | max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
8 | min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
9 | threads min_threads_count, max_threads_count
10 |
11 | # Specifies the `worker_timeout` threshold that Puma will use to wait before
12 | # terminating a worker in development environments.
13 | #
14 | worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
15 |
16 | # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
17 | #
18 | port ENV.fetch("PORT") { 3000 }
19 |
20 | # Specifies the `environment` that Puma will run in.
21 | #
22 | environment ENV.fetch("RAILS_ENV") { "development" }
23 |
24 | # Specifies the `pidfile` that Puma will use.
25 | pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
26 |
27 | # Specifies the number of `workers` to boot in clustered mode.
28 | # Workers are forked web server processes. If using threads and workers together
29 | # the concurrency of the application would be max `threads` * `workers`.
30 | # Workers do not work on JRuby or Windows (both of which do not support
31 | # processes).
32 | #
33 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
34 |
35 | # Use the `preload_app!` method when specifying a `workers` number.
36 | # This directive tells Puma to first boot the application and load code
37 | # before forking the application. This takes advantage of Copy On Write
38 | # process behavior so workers use less memory.
39 | #
40 | # preload_app!
41 |
42 | # Allow puma to be restarted by `bin/rails restart` command.
43 | plugin :tmp_restart
44 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | # The test environment is used exclusively to run your application's
4 | # test suite. You never need to work with it otherwise. Remember that
5 | # your test database is "scratch space" for the test suite and is wiped
6 | # and recreated between test runs. Don't rely on the data there!
7 |
8 | Rails.application.configure do
9 | # Settings specified here will take precedence over those in config/application.rb.
10 |
11 | # Turn false under Spring and add config.action_view.cache_template_loading = true.
12 | config.cache_classes = true
13 |
14 | # Eager loading loads your whole application. When running a single test locally,
15 | # this probably isn't necessary. It's a good idea to do in a continuous integration
16 | # system, or in some way before deploying your code.
17 | config.eager_load = ENV["CI"].present?
18 |
19 | # Configure public file server for tests with Cache-Control for performance.
20 | config.public_file_server.enabled = true
21 | config.public_file_server.headers = {
22 | "Cache-Control" => "public, max-age=#{1.hour.to_i}"
23 | }
24 |
25 | # Show full error reports and disable caching.
26 | config.consider_all_requests_local = true
27 | config.action_controller.perform_caching = false
28 | config.cache_store = :null_store
29 |
30 | # Raise exceptions instead of rendering exception templates.
31 | config.action_dispatch.show_exceptions = false
32 |
33 | # Disable request forgery protection in test environment.
34 | config.action_controller.allow_forgery_protection = false
35 |
36 | # Store uploaded files on the local file system in a temporary directory.
37 | config.active_storage.service = :test
38 |
39 | config.action_mailer.perform_caching = false
40 |
41 | # Tell Action Mailer not to deliver emails to the real world.
42 | # The :test delivery method accumulates sent emails in the
43 | # ActionMailer::Base.deliveries array.
44 | config.action_mailer.delivery_method = :test
45 |
46 | # Print deprecation notices to the stderr.
47 | config.active_support.deprecation = :stderr
48 |
49 | # Raise exceptions for disallowed deprecations.
50 | config.active_support.disallowed_deprecation = :raise
51 |
52 | # Tell Active Support which deprecation messages to disallow.
53 | config.active_support.disallowed_deprecation_warnings = []
54 |
55 | # Raises error for missing translations.
56 | # config.i18n.raise_on_missing_translations = true
57 |
58 | # Annotate rendered view with file names.
59 | # config.action_view.annotate_rendered_view_with_filenames = true
60 | end
61 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | source "https://rubygems.org"
2 | git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3 |
4 | ruby "3.2.2"
5 |
6 | # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
7 | gem "rails", "~> 7.0.6"
8 |
9 | # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
10 | gem "sprockets-rails"
11 |
12 | # Use postgresql as the database for Active Record
13 | gem "pg", "~> 1.1"
14 |
15 | # Use the Puma web server [https://github.com/puma/puma]
16 | gem "puma", "~> 5.0"
17 |
18 | # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
19 | gem "importmap-rails"
20 |
21 | # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
22 | gem "turbo-rails"
23 |
24 | # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
25 | gem "stimulus-rails"
26 |
27 | # Build JSON APIs with ease [https://github.com/rails/jbuilder]
28 | gem "jbuilder"
29 |
30 | # Use Redis adapter to run Action Cable in production
31 | # gem "redis", "~> 4.0"
32 |
33 | # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
34 | # gem "kredis"
35 |
36 | # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
37 | # gem "bcrypt", "~> 3.1.7"
38 |
39 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
40 | gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]
41 |
42 | # Reduces boot times through caching; required in config/boot.rb
43 | gem "bootsnap", require: false
44 |
45 | # Use Sass to process CSS
46 | # gem "sassc-rails"
47 |
48 | # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
49 | # gem "image_processing", "~> 1.2"
50 |
51 | group :development, :test do
52 | # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
53 | gem "debug", platforms: %i[ mri mingw x64_mingw ]
54 | end
55 |
56 | group :development do
57 | # Use console on exceptions pages [https://github.com/rails/web-console]
58 | gem "web-console"
59 |
60 | # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
61 | # gem "rack-mini-profiler"
62 |
63 | # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
64 | # gem "spring"
65 | end
66 |
67 | group :test do
68 | # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
69 | gem "capybara"
70 | gem "selenium-webdriver"
71 | gem "webdrivers"
72 | end
73 | gem 'rubocop', '>= 1.0', '< 2.0'
74 | gem 'rails-controller-testing'
75 | gem 'rspec-rails'
76 | gem 'rack-cors'
77 |
--------------------------------------------------------------------------------
/config/environments/development.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # In the development environment your application's code is reloaded any time
7 | # it changes. This slows down response time but is perfect for development
8 | # since you don't have to restart the web server when you make code changes.
9 | config.cache_classes = false
10 |
11 | # Do not eager load code on boot.
12 | config.eager_load = false
13 |
14 | # Show full error reports.
15 | config.consider_all_requests_local = true
16 |
17 | # Enable server timing
18 | config.server_timing = true
19 |
20 | # Enable/disable caching. By default caching is disabled.
21 | # Run rails dev:cache to toggle caching.
22 | if Rails.root.join("tmp/caching-dev.txt").exist?
23 | config.action_controller.perform_caching = true
24 | config.action_controller.enable_fragment_cache_logging = true
25 |
26 | config.cache_store = :memory_store
27 | config.public_file_server.headers = {
28 | "Cache-Control" => "public, max-age=#{2.days.to_i}"
29 | }
30 | else
31 | config.action_controller.perform_caching = false
32 |
33 | config.cache_store = :null_store
34 | end
35 |
36 | # Store uploaded files on the local file system (see config/storage.yml for options).
37 | config.active_storage.service = :local
38 |
39 | # Don't care if the mailer can't send.
40 | config.action_mailer.raise_delivery_errors = false
41 |
42 | config.action_mailer.perform_caching = false
43 |
44 | # Print deprecation notices to the Rails logger.
45 | config.active_support.deprecation = :log
46 |
47 | # Raise exceptions for disallowed deprecations.
48 | config.active_support.disallowed_deprecation = :raise
49 |
50 | # Tell Active Support which deprecation messages to disallow.
51 | config.active_support.disallowed_deprecation_warnings = []
52 |
53 | # Raise an error on page load if there are pending migrations.
54 | config.active_record.migration_error = :page_load
55 |
56 | # Highlight code that triggered database queries in logs.
57 | config.active_record.verbose_query_logs = true
58 |
59 | # Suppress logger output for asset requests.
60 | config.assets.quiet = true
61 |
62 | # Raises error for missing translations.
63 | # config.i18n.raise_on_missing_translations = true
64 |
65 | # Annotate rendered view with file names.
66 | # config.action_view.annotate_rendered_view_with_filenames = true
67 |
68 | # Uncomment if you wish to allow Action Cable access from any origin.
69 | # config.action_cable.disable_request_forgery_protection = true
70 | end
71 |
--------------------------------------------------------------------------------
/spec/rails_helper.rb:
--------------------------------------------------------------------------------
1 | # This file is copied to spec/ when you run 'rails generate rspec:install'
2 | require 'spec_helper'
3 | ENV['RAILS_ENV'] ||= 'test'
4 | require_relative '../config/environment'
5 | # Prevent database truncation if the environment is production
6 | abort('The Rails environment is running in production mode!') if Rails.env.production?
7 | require 'rspec/rails'
8 | # Add additional requires below this line. Rails is not loaded until this point!
9 |
10 | # Requires supporting ruby files with custom matchers and macros, etc, in
11 | # spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
12 | # run as spec files by default. This means that files in spec/support that end
13 | # in _spec.rb will both be required and run as specs, causing the specs to be
14 | # run twice. It is recommended that you do not name files matching this glob to
15 | # end with _spec.rb. You can configure this pattern with the --pattern
16 | # option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
17 | #
18 | # The following line is provided for convenience purposes. It has the downside
19 | # of increasing the boot-up time by auto-requiring all files in the support
20 | # directory. Alternatively, in the individual `*_spec.rb` files, manually
21 | # require only the support files necessary.
22 | #
23 | # Dir[Rails.root.join('spec', 'support', '**', '*.rb')].sort.each { |f| require f }
24 |
25 | # Checks for pending migrations and applies them before tests are run.
26 | # If you are not using ActiveRecord, you can remove these lines.
27 | begin
28 | ActiveRecord::Migration.maintain_test_schema!
29 | rescue ActiveRecord::PendingMigrationError => e
30 | abort e.to_s.strip
31 | end
32 | RSpec.configure do |config|
33 | # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
34 | config.fixture_path = "#{Rails.root}/spec/fixtures"
35 |
36 | # If you're not using ActiveRecord, or you'd prefer not to run each of your
37 | # examples within a transaction, remove the following line or assign false
38 | # instead of true.
39 | config.use_transactional_fixtures = true
40 |
41 | # You can uncomment this line to turn off ActiveRecord support entirely.
42 | # config.use_active_record = false
43 |
44 | # RSpec Rails can automatically mix in different behaviours to your tests
45 | # based on their file location, for example enabling you to call `get` and
46 | # `post` in specs under `spec/controllers`.
47 | #
48 | # You can disable this behaviour by removing the line below, and instead
49 | # explicitly tag your specs with their type, e.g.:
50 | #
51 | # RSpec.describe UsersController, type: :controller do
52 | # # ...
53 | # end
54 | #
55 | # The different available types are documented in the features, such as in
56 | # https://rspec.info/features/6-0/rspec-rails
57 | config.infer_spec_type_from_file_location!
58 |
59 | # Filter lines from Rails gems in backtraces.
60 | config.filter_rails_from_backtrace!
61 | # arbitrary gems may also be filtered via:
62 | # config.filter_gems_from_backtrace("gem name")
63 | end
64 |
--------------------------------------------------------------------------------
/bin/bundle:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | # frozen_string_literal: true
3 |
4 | #
5 | # This file was generated by Bundler.
6 | #
7 | # The application 'bundle' is installed as part of a gem, and
8 | # this file is here to facilitate running it.
9 | #
10 |
11 | require "rubygems"
12 |
13 | m = Module.new do
14 | module_function
15 |
16 | def invoked_as_script?
17 | File.expand_path($0) == File.expand_path(__FILE__)
18 | end
19 |
20 | def env_var_version
21 | ENV["BUNDLER_VERSION"]
22 | end
23 |
24 | def cli_arg_version
25 | return unless invoked_as_script? # don't want to hijack other binstubs
26 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
27 | bundler_version = nil
28 | update_index = nil
29 | ARGV.each_with_index do |a, i|
30 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
31 | bundler_version = a
32 | end
33 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
34 | bundler_version = $1
35 | update_index = i
36 | end
37 | bundler_version
38 | end
39 |
40 | def gemfile
41 | gemfile = ENV["BUNDLE_GEMFILE"]
42 | return gemfile if gemfile && !gemfile.empty?
43 |
44 | File.expand_path("../Gemfile", __dir__)
45 | end
46 |
47 | def lockfile
48 | lockfile =
49 | case File.basename(gemfile)
50 | when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
51 | else "#{gemfile}.lock"
52 | end
53 | File.expand_path(lockfile)
54 | end
55 |
56 | def lockfile_version
57 | return unless File.file?(lockfile)
58 | lockfile_contents = File.read(lockfile)
59 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
60 | Regexp.last_match(1)
61 | end
62 |
63 | def bundler_requirement
64 | @bundler_requirement ||=
65 | env_var_version ||
66 | cli_arg_version ||
67 | bundler_requirement_for(lockfile_version)
68 | end
69 |
70 | def bundler_requirement_for(version)
71 | return "#{Gem::Requirement.default}.a" unless version
72 |
73 | bundler_gem_version = Gem::Version.new(version)
74 |
75 | bundler_gem_version.approximate_recommendation
76 | end
77 |
78 | def load_bundler!
79 | ENV["BUNDLE_GEMFILE"] ||= gemfile
80 |
81 | activate_bundler
82 | end
83 |
84 | def activate_bundler
85 | gem_error = activation_error_handling do
86 | gem "bundler", bundler_requirement
87 | end
88 | return if gem_error.nil?
89 | require_error = activation_error_handling do
90 | require "bundler/version"
91 | end
92 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
93 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
94 | exit 42
95 | end
96 |
97 | def activation_error_handling
98 | yield
99 | nil
100 | rescue StandardError, LoadError => e
101 | e
102 | end
103 | end
104 |
105 | m.load_bundler!
106 |
107 | if m.invoked_as_script?
108 | load Gem.bin_path("bundler", "bundle")
109 | end
110 |
--------------------------------------------------------------------------------
/bin/bundle.cmd:
--------------------------------------------------------------------------------
1 | @ruby -x "%~f0" %*
2 | @exit /b %ERRORLEVEL%
3 |
4 | #!/usr/bin/env ruby
5 | # frozen_string_literal: true
6 |
7 | #
8 | # This file was generated by Bundler.
9 | #
10 | # The application 'bundle' is installed as part of a gem, and
11 | # this file is here to facilitate running it.
12 | #
13 |
14 | require "rubygems"
15 |
16 | m = Module.new do
17 | module_function
18 |
19 | def invoked_as_script?
20 | File.expand_path($0) == File.expand_path(__FILE__)
21 | end
22 |
23 | def env_var_version
24 | ENV["BUNDLER_VERSION"]
25 | end
26 |
27 | def cli_arg_version
28 | return unless invoked_as_script? # don't want to hijack other binstubs
29 | return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update`
30 | bundler_version = nil
31 | update_index = nil
32 | ARGV.each_with_index do |a, i|
33 | if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
34 | bundler_version = a
35 | end
36 | next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/
37 | bundler_version = $1
38 | update_index = i
39 | end
40 | bundler_version
41 | end
42 |
43 | def gemfile
44 | gemfile = ENV["BUNDLE_GEMFILE"]
45 | return gemfile if gemfile && !gemfile.empty?
46 |
47 | File.expand_path("../Gemfile", __dir__)
48 | end
49 |
50 | def lockfile
51 | lockfile =
52 | case File.basename(gemfile)
53 | when "gems.rb" then gemfile.sub(/\.rb$/, ".locked")
54 | else "#{gemfile}.lock"
55 | end
56 | File.expand_path(lockfile)
57 | end
58 |
59 | def lockfile_version
60 | return unless File.file?(lockfile)
61 | lockfile_contents = File.read(lockfile)
62 | return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/
63 | Regexp.last_match(1)
64 | end
65 |
66 | def bundler_requirement
67 | @bundler_requirement ||=
68 | env_var_version ||
69 | cli_arg_version ||
70 | bundler_requirement_for(lockfile_version)
71 | end
72 |
73 | def bundler_requirement_for(version)
74 | return "#{Gem::Requirement.default}.a" unless version
75 |
76 | bundler_gem_version = Gem::Version.new(version)
77 |
78 | bundler_gem_version.approximate_recommendation
79 | end
80 |
81 | def load_bundler!
82 | ENV["BUNDLE_GEMFILE"] ||= gemfile
83 |
84 | activate_bundler
85 | end
86 |
87 | def activate_bundler
88 | gem_error = activation_error_handling do
89 | gem "bundler", bundler_requirement
90 | end
91 | return if gem_error.nil?
92 | require_error = activation_error_handling do
93 | require "bundler/version"
94 | end
95 | return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION))
96 | warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`"
97 | exit 42
98 | end
99 |
100 | def activation_error_handling
101 | yield
102 | nil
103 | rescue StandardError, LoadError => e
104 | e
105 | end
106 | end
107 |
108 | m.load_bundler!
109 |
110 | if m.invoked_as_script?
111 | load Gem.bin_path("bundler", "bundle")
112 | end
113 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | # PostgreSQL. Versions 9.3 and up are supported.
2 | #
3 | # Install the pg driver:
4 | # gem install pg
5 | # On macOS with Homebrew:
6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config
7 | # On macOS with MacPorts:
8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
9 | # On Windows:
10 | # gem install pg
11 | # Choose the win32 build.
12 | # Install PostgreSQL and put its /bin directory on your path.
13 | #
14 | # Configure Using Gemfile
15 | # gem "pg"
16 | #
17 | default: &default
18 | adapter: postgresql
19 | encoding: unicode
20 | # For details on connection pooling, see Rails configuration guide
21 | # https://guides.rubyonrails.org/configuring.html#database-pooling
22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
23 | username: postgres
24 | password: <%= ENV["DB_PASSWORD"] %>
25 |
26 | development:
27 | <<: *default
28 | database: SearchOpt_development
29 |
30 | # The specified database role being used to connect to postgres.
31 | # To create additional roles in postgres see `$ createuser --help`.
32 | # When left blank, postgres will use the default role. This is
33 | # the same name as the operating system user running Rails.
34 | #username: SearchOpt
35 |
36 | # The password associated with the postgres role (username).
37 | #password:
38 |
39 | # Connect on a TCP socket. Omitted by default since the client uses a
40 | # domain socket that doesn't need configuration. Windows does not have
41 | # domain sockets, so uncomment these lines.
42 | #host: localhost
43 |
44 | # The TCP port the server listens on. Defaults to 5432.
45 | # If your server runs on a different port number, change accordingly.
46 | #port: 5432
47 |
48 | # Schema search path. The server defaults to $user,public
49 | #schema_search_path: myapp,sharedapp,public
50 |
51 | # Minimum log levels, in increasing order:
52 | # debug5, debug4, debug3, debug2, debug1,
53 | # log, notice, warning, error, fatal, and panic
54 | # Defaults to warning.
55 | #min_messages: notice
56 |
57 | # Warning: The database defined as "test" will be erased and
58 | # re-generated from your development database when you run "rake".
59 | # Do not set this db to the same as development or production.
60 | test:
61 | <<: *default
62 | database: SearchOpt_test
63 |
64 | # As with config/credentials.yml, you never want to store sensitive information,
65 | # like your database password, in your source code. If your source code is
66 | # ever seen by anyone, they now have access to your database.
67 | #
68 | # Instead, provide the password or a full connection URL as an environment
69 | # variable when you boot the app. For example:
70 | #
71 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase"
72 | #
73 | # If the connection URL is provided in the special DATABASE_URL environment
74 | # variable, Rails will automatically merge its configuration values on top of
75 | # the values provided in this file. Alternatively, you can specify a connection
76 | # URL environment variable explicitly:
77 | #
78 | # production:
79 | # url: <%= ENV["MY_APP_DATABASE_URL"] %>
80 | #
81 | # Read https://guides.rubyonrails.org/configuring.html#configuring-a-database
82 | # for a full overview on how database connection configuration can be specified.
83 | #
84 |
85 | production:
86 | <<: *default
87 | url: <%= ENV['DATABASE_URL'] %>
88 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | require "active_support/core_ext/integer/time"
2 |
3 | Rails.application.configure do
4 | # Settings specified here will take precedence over those in config/application.rb.
5 |
6 | # Code is not reloaded between requests.
7 | config.cache_classes = true
8 |
9 | # Eager load code on boot. This eager loads most of Rails and
10 | # your application in memory, allowing both threaded web servers
11 | # and those relying on copy on write to perform better.
12 | # Rake tasks automatically ignore this option for performance.
13 | config.eager_load = true
14 |
15 | # Full error reports are disabled and caching is turned on.
16 | config.consider_all_requests_local = false
17 | config.action_controller.perform_caching = true
18 |
19 | # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
20 | # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
21 | # config.require_master_key = true
22 |
23 | # Disable serving static files from the `/public` folder by default since
24 | # Apache or NGINX already handles this.
25 | config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
26 |
27 | # Compress CSS using a preprocessor.
28 | # config.assets.css_compressor = :sass
29 |
30 | # Do not fallback to assets pipeline if a precompiled asset is missed.
31 | config.assets.compile = false
32 |
33 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
34 | # config.asset_host = "http://assets.example.com"
35 |
36 | # Specifies the header that your server uses for sending files.
37 | # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
38 | # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
39 |
40 | # Store uploaded files on the local file system (see config/storage.yml for options).
41 | config.active_storage.service = :local
42 |
43 | # Mount Action Cable outside main process or domain.
44 | # config.action_cable.mount_path = nil
45 | # config.action_cable.url = "wss://example.com/cable"
46 | # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
47 |
48 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
49 | # config.force_ssl = true
50 |
51 | # Include generic and useful information about system operation, but avoid logging too much
52 | # information to avoid inadvertent exposure of personally identifiable information (PII).
53 | config.log_level = :info
54 |
55 | # Prepend all log lines with the following tags.
56 | config.log_tags = [ :request_id ]
57 |
58 | # Use a different cache store in production.
59 | # config.cache_store = :mem_cache_store
60 |
61 | # Use a real queuing backend for Active Job (and separate queues per environment).
62 | # config.active_job.queue_adapter = :resque
63 | # config.active_job.queue_name_prefix = "SearchOpt_production"
64 |
65 | config.action_mailer.perform_caching = false
66 |
67 | # Ignore bad email addresses and do not raise email delivery errors.
68 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
69 | # config.action_mailer.raise_delivery_errors = false
70 |
71 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
72 | # the I18n.default_locale when a translation cannot be found).
73 | config.i18n.fallbacks = true
74 |
75 | # Don't log any deprecations.
76 | config.active_support.report_deprecations = false
77 |
78 | # Use default logging formatter so that PID and timestamp are not suppressed.
79 | config.log_formatter = ::Logger::Formatter.new
80 |
81 | # Use a different logger for distributed setups.
82 | # require "syslog/logger"
83 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
84 |
85 | if ENV["RAILS_LOG_TO_STDOUT"].present?
86 | logger = ActiveSupport::Logger.new(STDOUT)
87 | logger.formatter = config.log_formatter
88 | config.logger = ActiveSupport::TaggedLogging.new(logger)
89 | end
90 |
91 | # Do not dump schema after migrations.
92 | config.active_record.dump_schema_after_migration = false
93 | end
94 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # 📗 Table of Contents
4 |
5 | - [📗 Table of Contents](#-table-of-contents)
6 | - [📖 Real-time Search ](#-real-time-search-)
7 | - [🛠 Built With ](#-built-with-)
8 | - [Tech Stack ](#tech-stack-)
9 | - [Key Features ](#key-features-)
10 | - [💻 Getting Started ](#-getting-started-)
11 | - [Prerequisites](#prerequisites)
12 | - [Setup](#setup)
13 | - [Install](#install)
14 | - [Usage](#usage)
15 | - [Run tests](#run-tests)
16 | - [Project Walkthrough](#project-walkthrough)
17 | - [Deployment](#deployment)
18 | - [👥 Authors ](#-authors-)
19 | - [🔭 Future Features ](#-future-features-)
20 | - [🤝 Contributing ](#-contributing-)
21 | - [⭐️ Show your support ](#️-show-your-support-)
22 | - [❓ FAQ ](#-faq-)
23 | - [📝 License ](#-license-)
24 |
25 |
26 |
27 | # 📖 Real-time Search
28 |
29 |
30 | **Real-time Search** is a rails app which lets users see and add their expense category, and expense
31 |
32 | ## 🛠 Built With
33 |
34 | ### Tech Stack
35 |
36 |
37 |
38 | Backend
39 |
42 |
43 |
44 |
45 |
46 | ### Key Features
47 |
48 |
49 | - **Show real-time suggestion based on previous search**
50 |
51 |
52 |
53 |
54 |
55 | (back to top)
56 |
57 |
58 |
59 | ## 💻 Getting Started
60 |
61 | To get a local copy up and running, follow these steps.
62 |
63 | ### Prerequisites
64 |
65 | In order to run this project you need:
66 |
67 |
74 | - Install ruby on your machine
75 | - Install rails on your machine
76 |
77 | ### Setup
78 |
79 | Clone this repository to your desired folder:
80 |
81 | ```
82 | git@github.com:zdnahom/budget-app.git
83 | ```
84 | ### Install
85 |
86 | Install this project with:
87 |
88 | ```
89 | cd SearchOpt
90 | ```
91 |
92 |
93 |
94 | ```
95 | bundle install
96 | ```
97 |
98 | ### Usage
99 |
100 | To run the project, execute the following command:
101 |
102 | ```
103 | rails s
104 | ```
105 |
106 | ### Run tests
107 |
108 | To run tests, run the following command:
109 |
110 | ```
111 | rspec spec
112 | ```
113 |
114 | ### Project Walkthrough
115 |
116 | You can see this project's demonstaration here:
117 |
118 | - [Video](https://www.loom.com/share/482b930282164497977636328a065820?sid=27ac8e1f-d854-4c8d-aecd-ba81495aaaf0)
119 |
120 | (back to top)
121 |
122 | ### Deployment
123 |
124 | You can deploy this project using:
125 |
126 | - [Live](https://expense-planner.onrender.com/)
127 |
128 | (back to top)
129 |
130 |
131 |
132 | ## 👥 Authors
133 |
134 |
135 | 👤 **Author1**
136 |
137 | - GitHub: [@zdnahom](https://github.com/zdnahom)
138 | - LinkedIn: [LinkedIn](https://linkedin.com/in/nahomzd)
139 |
140 |
141 | (back to top)
142 |
143 |
144 |
145 | ## 🔭 Future Features
146 |
147 | - [ ] **Add cool animations**
148 |
149 |
150 | (back to top)
151 |
152 |
153 |
154 | ## 🤝 Contributing
155 |
156 | Contributions, issues, and feature requests are welcome!
157 |
158 | Feel free to check the [issues page](https://github.com/zdnahom/budget-app/issues/).
159 |
160 | (back to top)
161 |
162 |
163 |
164 | ## ⭐️ Show your support
165 |
166 |
167 | If you like this project, clone it and try it.
168 |
169 | (back to top)
170 |
171 |
172 |
173 |
174 |
175 | ## ❓ FAQ
176 |
177 | - **Does this work**
178 |
179 | - Of course it works perfectly.
180 |
181 | - **Is it good for newbie developers**
182 |
183 | - Of course it is.
184 |
185 | (back to top)
186 |
187 |
188 |
189 | ## 📝 License
190 |
191 | This project is [MIT](./LICENSE) licensed.
192 |
193 |
194 | (back to top)
195 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | # This file was generated by the `rails generate rspec:install` command. Conventionally, all
2 | # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3 | # The generated `.rspec` file contains `--require spec_helper` which will cause
4 | # this file to always be loaded, without a need to explicitly require it in any
5 | # files.
6 | #
7 | # Given that it is always loaded, you are encouraged to keep this file as
8 | # light-weight as possible. Requiring heavyweight dependencies from this file
9 | # will add to the boot time of your test suite on EVERY test run, even for an
10 | # individual file that may not need all of that loaded. Instead, consider making
11 | # a separate helper file that requires the additional dependencies and performs
12 | # the additional setup, and require it from the spec files that actually need
13 | # it.
14 | #
15 | # See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
16 | RSpec.configure do |config|
17 | # rspec-expectations config goes here. You can use an alternate
18 | # assertion/expectation library such as wrong or the stdlib/minitest
19 | # assertions if you prefer.
20 | config.expect_with :rspec do |expectations|
21 | # This option will default to `true` in RSpec 4. It makes the `description`
22 | # and `failure_message` of custom matchers include text for helper methods
23 | # defined using `chain`, e.g.:
24 | # be_bigger_than(2).and_smaller_than(4).description
25 | # # => "be bigger than 2 and smaller than 4"
26 | # ...rather than:
27 | # # => "be bigger than 2"
28 | expectations.include_chain_clauses_in_custom_matcher_descriptions = true
29 | end
30 |
31 | # rspec-mocks config goes here. You can use an alternate test double
32 | # library (such as bogus or mocha) by changing the `mock_with` option here.
33 | config.mock_with :rspec do |mocks|
34 | # Prevents you from mocking or stubbing a method that does not exist on
35 | # a real object. This is generally recommended, and will default to
36 | # `true` in RSpec 4.
37 | mocks.verify_partial_doubles = true
38 | end
39 |
40 | # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
41 | # have no way to turn it off -- the option exists only for backwards
42 | # compatibility in RSpec 3). It causes shared context metadata to be
43 | # inherited by the metadata hash of host groups and examples, rather than
44 | # triggering implicit auto-inclusion in groups with matching metadata.
45 | config.shared_context_metadata_behavior = :apply_to_host_groups
46 |
47 | # The settings below are suggested to provide a good initial experience
48 | # with RSpec, but feel free to customize to your heart's content.
49 | # # This allows you to limit a spec run to individual examples or groups
50 | # # you care about by tagging them with `:focus` metadata. When nothing
51 | # # is tagged with `:focus`, all examples get run. RSpec also provides
52 | # # aliases for `it`, `describe`, and `context` that include `:focus`
53 | # # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
54 | # config.filter_run_when_matching :focus
55 | #
56 | # # Allows RSpec to persist some state between runs in order to support
57 | # # the `--only-failures` and `--next-failure` CLI options. We recommend
58 | # # you configure your source control system to ignore this file.
59 | # config.example_status_persistence_file_path = "spec/examples.txt"
60 | #
61 | # # Limits the available syntax to the non-monkey patched syntax that is
62 | # # recommended. For more details, see:
63 | # # https://rspec.info/features/3-12/rspec-core/configuration/zero-monkey-patching-mode/
64 | # config.disable_monkey_patching!
65 | #
66 | # # This setting enables warnings. It's recommended, but in some cases may
67 | # # be too noisy due to issues in dependencies.
68 | # config.warnings = true
69 | #
70 | # # Many RSpec users commonly either run the entire suite or an individual
71 | # # file, and it's useful to allow more verbose output when running an
72 | # # individual spec file.
73 | # if config.files_to_run.one?
74 | # # Use the documentation formatter for detailed output,
75 | # # unless a formatter has already been configured
76 | # # (e.g. via a command-line flag).
77 | # config.default_formatter = "doc"
78 | # end
79 | #
80 | # # Print the 10 slowest examples and example groups at the
81 | # # end of the spec run, to help surface which specs are running
82 | # # particularly slow.
83 | # config.profile_examples = 10
84 | #
85 | # # Run specs in random order to surface order dependencies. If you find an
86 | # # order dependency and want to debug it, you can fix the order by providing
87 | # # the seed, which is printed after each run.
88 | # # --seed 1234
89 | # config.order = :random
90 | #
91 | # # Seed global randomization in this process using the `--seed` CLI option.
92 | # # Setting this allows you to use `--seed` to deterministically reproduce
93 | # # test failures related to randomization by passing the same `--seed` value
94 | # # as the one that triggered the failure.
95 | # Kernel.srand config.seed
96 | end
97 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actioncable (7.0.6)
5 | actionpack (= 7.0.6)
6 | activesupport (= 7.0.6)
7 | nio4r (~> 2.0)
8 | websocket-driver (>= 0.6.1)
9 | actionmailbox (7.0.6)
10 | actionpack (= 7.0.6)
11 | activejob (= 7.0.6)
12 | activerecord (= 7.0.6)
13 | activestorage (= 7.0.6)
14 | activesupport (= 7.0.6)
15 | mail (>= 2.7.1)
16 | net-imap
17 | net-pop
18 | net-smtp
19 | actionmailer (7.0.6)
20 | actionpack (= 7.0.6)
21 | actionview (= 7.0.6)
22 | activejob (= 7.0.6)
23 | activesupport (= 7.0.6)
24 | mail (~> 2.5, >= 2.5.4)
25 | net-imap
26 | net-pop
27 | net-smtp
28 | rails-dom-testing (~> 2.0)
29 | actionpack (7.0.6)
30 | actionview (= 7.0.6)
31 | activesupport (= 7.0.6)
32 | rack (~> 2.0, >= 2.2.4)
33 | rack-test (>= 0.6.3)
34 | rails-dom-testing (~> 2.0)
35 | rails-html-sanitizer (~> 1.0, >= 1.2.0)
36 | actiontext (7.0.6)
37 | actionpack (= 7.0.6)
38 | activerecord (= 7.0.6)
39 | activestorage (= 7.0.6)
40 | activesupport (= 7.0.6)
41 | globalid (>= 0.6.0)
42 | nokogiri (>= 1.8.5)
43 | actionview (7.0.6)
44 | activesupport (= 7.0.6)
45 | builder (~> 3.1)
46 | erubi (~> 1.4)
47 | rails-dom-testing (~> 2.0)
48 | rails-html-sanitizer (~> 1.1, >= 1.2.0)
49 | activejob (7.0.6)
50 | activesupport (= 7.0.6)
51 | globalid (>= 0.3.6)
52 | activemodel (7.0.6)
53 | activesupport (= 7.0.6)
54 | activerecord (7.0.6)
55 | activemodel (= 7.0.6)
56 | activesupport (= 7.0.6)
57 | activestorage (7.0.6)
58 | actionpack (= 7.0.6)
59 | activejob (= 7.0.6)
60 | activerecord (= 7.0.6)
61 | activesupport (= 7.0.6)
62 | marcel (~> 1.0)
63 | mini_mime (>= 1.1.0)
64 | activesupport (7.0.6)
65 | concurrent-ruby (~> 1.0, >= 1.0.2)
66 | i18n (>= 1.6, < 2)
67 | minitest (>= 5.1)
68 | tzinfo (~> 2.0)
69 | addressable (2.8.4)
70 | public_suffix (>= 2.0.2, < 6.0)
71 | ast (2.4.2)
72 | bindex (0.8.1)
73 | bootsnap (1.16.0)
74 | msgpack (~> 1.2)
75 | builder (3.2.4)
76 | capybara (3.39.2)
77 | addressable
78 | matrix
79 | mini_mime (>= 0.1.3)
80 | nokogiri (~> 1.8)
81 | rack (>= 1.6.0)
82 | rack-test (>= 0.6.3)
83 | regexp_parser (>= 1.5, < 3.0)
84 | xpath (~> 3.2)
85 | concurrent-ruby (1.2.2)
86 | crass (1.0.6)
87 | date (3.3.3)
88 | debug (1.8.0)
89 | irb (>= 1.5.0)
90 | reline (>= 0.3.1)
91 | diff-lcs (1.5.0)
92 | erubi (1.12.0)
93 | globalid (1.1.0)
94 | activesupport (>= 5.0)
95 | i18n (1.14.1)
96 | concurrent-ruby (~> 1.0)
97 | importmap-rails (1.2.1)
98 | actionpack (>= 6.0.0)
99 | railties (>= 6.0.0)
100 | io-console (0.6.0)
101 | irb (1.7.3)
102 | reline (>= 0.3.6)
103 | jbuilder (2.11.5)
104 | actionview (>= 5.0.0)
105 | activesupport (>= 5.0.0)
106 | json (2.7.1)
107 | language_server-protocol (3.17.0.3)
108 | loofah (2.21.3)
109 | crass (~> 1.0.2)
110 | nokogiri (>= 1.12.0)
111 | mail (2.8.1)
112 | mini_mime (>= 0.1.1)
113 | net-imap
114 | net-pop
115 | net-smtp
116 | marcel (1.0.2)
117 | matrix (0.4.2)
118 | method_source (1.0.0)
119 | mini_mime (1.1.2)
120 | minitest (5.20.0)
121 | msgpack (1.7.1)
122 | net-imap (0.3.6)
123 | date
124 | net-protocol
125 | net-pop (0.1.2)
126 | net-protocol
127 | net-protocol (0.2.1)
128 | timeout
129 | net-smtp (0.3.3)
130 | net-protocol
131 | nio4r (2.5.9)
132 | nokogiri (1.15.3-x64-mingw-ucrt)
133 | racc (~> 1.4)
134 | nokogiri (1.15.3-x86_64-linux)
135 | racc (~> 1.4)
136 | parallel (1.24.0)
137 | parser (3.3.0.2)
138 | ast (~> 2.4.1)
139 | racc
140 | pg (1.5.3)
141 | pg (1.5.3-x64-mingw-ucrt)
142 | public_suffix (5.0.3)
143 | puma (5.6.6)
144 | nio4r (~> 2.0)
145 | racc (1.7.1)
146 | rack (2.2.7)
147 | rack-cors (2.0.1)
148 | rack (>= 2.0.0)
149 | rack-test (2.1.0)
150 | rack (>= 1.3)
151 | rails (7.0.6)
152 | actioncable (= 7.0.6)
153 | actionmailbox (= 7.0.6)
154 | actionmailer (= 7.0.6)
155 | actionpack (= 7.0.6)
156 | actiontext (= 7.0.6)
157 | actionview (= 7.0.6)
158 | activejob (= 7.0.6)
159 | activemodel (= 7.0.6)
160 | activerecord (= 7.0.6)
161 | activestorage (= 7.0.6)
162 | activesupport (= 7.0.6)
163 | bundler (>= 1.15.0)
164 | railties (= 7.0.6)
165 | rails-controller-testing (1.0.5)
166 | actionpack (>= 5.0.1.rc1)
167 | actionview (>= 5.0.1.rc1)
168 | activesupport (>= 5.0.1.rc1)
169 | rails-dom-testing (2.1.1)
170 | activesupport (>= 5.0.0)
171 | minitest
172 | nokogiri (>= 1.6)
173 | rails-html-sanitizer (1.6.0)
174 | loofah (~> 2.21)
175 | nokogiri (~> 1.14)
176 | railties (7.0.6)
177 | actionpack (= 7.0.6)
178 | activesupport (= 7.0.6)
179 | method_source
180 | rake (>= 12.2)
181 | thor (~> 1.0)
182 | zeitwerk (~> 2.5)
183 | rainbow (3.1.1)
184 | rake (13.0.6)
185 | regexp_parser (2.8.1)
186 | reline (0.3.6)
187 | io-console (~> 0.5)
188 | rexml (3.2.5)
189 | rspec-core (3.12.2)
190 | rspec-support (~> 3.12.0)
191 | rspec-expectations (3.12.3)
192 | diff-lcs (>= 1.2.0, < 2.0)
193 | rspec-support (~> 3.12.0)
194 | rspec-mocks (3.12.6)
195 | diff-lcs (>= 1.2.0, < 2.0)
196 | rspec-support (~> 3.12.0)
197 | rspec-rails (6.1.0)
198 | actionpack (>= 6.1)
199 | activesupport (>= 6.1)
200 | railties (>= 6.1)
201 | rspec-core (~> 3.12)
202 | rspec-expectations (~> 3.12)
203 | rspec-mocks (~> 3.12)
204 | rspec-support (~> 3.12)
205 | rspec-support (3.12.1)
206 | rubocop (1.59.0)
207 | json (~> 2.3)
208 | language_server-protocol (>= 3.17.0)
209 | parallel (~> 1.10)
210 | parser (>= 3.2.2.4)
211 | rainbow (>= 2.2.2, < 4.0)
212 | regexp_parser (>= 1.8, < 3.0)
213 | rexml (>= 3.2.5, < 4.0)
214 | rubocop-ast (>= 1.30.0, < 2.0)
215 | ruby-progressbar (~> 1.7)
216 | unicode-display_width (>= 2.4.0, < 3.0)
217 | rubocop-ast (1.30.0)
218 | parser (>= 3.2.1.0)
219 | ruby-progressbar (1.13.0)
220 | rubyzip (2.3.2)
221 | selenium-webdriver (4.10.0)
222 | rexml (~> 3.2, >= 3.2.5)
223 | rubyzip (>= 1.2.2, < 3.0)
224 | websocket (~> 1.0)
225 | sprockets (4.2.0)
226 | concurrent-ruby (~> 1.0)
227 | rack (>= 2.2.4, < 4)
228 | sprockets-rails (3.4.2)
229 | actionpack (>= 5.2)
230 | activesupport (>= 5.2)
231 | sprockets (>= 3.0.0)
232 | stimulus-rails (1.2.1)
233 | railties (>= 6.0.0)
234 | thor (1.2.2)
235 | timeout (0.4.0)
236 | turbo-rails (1.4.0)
237 | actionpack (>= 6.0.0)
238 | activejob (>= 6.0.0)
239 | railties (>= 6.0.0)
240 | tzinfo (2.0.6)
241 | concurrent-ruby (~> 1.0)
242 | tzinfo-data (1.2023.3)
243 | tzinfo (>= 1.0.0)
244 | unicode-display_width (2.5.0)
245 | web-console (4.2.0)
246 | actionview (>= 6.0.0)
247 | activemodel (>= 6.0.0)
248 | bindex (>= 0.4.0)
249 | railties (>= 6.0.0)
250 | webdrivers (5.2.0)
251 | nokogiri (~> 1.6)
252 | rubyzip (>= 1.3.0)
253 | selenium-webdriver (~> 4.0)
254 | websocket (1.2.9)
255 | websocket-driver (0.7.5)
256 | websocket-extensions (>= 0.1.0)
257 | websocket-extensions (0.1.5)
258 | xpath (3.2.0)
259 | nokogiri (~> 1.8)
260 | zeitwerk (2.6.8)
261 |
262 | PLATFORMS
263 | x64-mingw-ucrt
264 | x86_64-linux
265 |
266 | DEPENDENCIES
267 | bootsnap
268 | capybara
269 | debug
270 | importmap-rails
271 | jbuilder
272 | pg (~> 1.1)
273 | puma (~> 5.0)
274 | rack-cors
275 | rails (~> 7.0.6)
276 | rails-controller-testing
277 | rspec-rails
278 | rubocop (>= 1.0, < 2.0)
279 | selenium-webdriver
280 | sprockets-rails
281 | stimulus-rails
282 | turbo-rails
283 | tzinfo-data
284 | web-console
285 | webdrivers
286 |
287 | RUBY VERSION
288 | ruby 3.2.2p53
289 |
290 | BUNDLED WITH
291 | 2.4.14
292 |
--------------------------------------------------------------------------------