-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/bixos/contatos.html.erb b/app/views/bixes/contatos.html.erb
similarity index 66%
rename from app/views/bixos/contatos.html.erb
rename to app/views/bixes/contatos.html.erb
index 6f41328..9cee6b9 100644
--- a/app/views/bixos/contatos.html.erb
+++ b/app/views/bixes/contatos.html.erb
@@ -1,11 +1,9 @@
-
Contatos
E-mails
-<% @bixos.each do |b| %>
+<% @bixes.each do |b| %>
<%= b.email %>,
<% end %>
-
-
+
\ No newline at end of file
diff --git a/app/views/bixes/emails.html.erb b/app/views/bixes/emails.html.erb
new file mode 100644
index 0000000..a5440a6
--- /dev/null
+++ b/app/views/bixes/emails.html.erb
@@ -0,0 +1 @@
+<%= @emails.join(', ') %>
\ No newline at end of file
diff --git a/app/views/bixos/index.html.erb b/app/views/bixes/index.html.erb
similarity index 67%
rename from app/views/bixos/index.html.erb
rename to app/views/bixes/index.html.erb
index ef52565..ae3225c 100644
--- a/app/views/bixos/index.html.erb
+++ b/app/views/bixes/index.html.erb
@@ -1,8 +1,7 @@
-
+
\ No newline at end of file
diff --git a/app/views/bixes/items.html.erb b/app/views/bixes/items.html.erb
new file mode 100644
index 0000000..7e6fb47
--- /dev/null
+++ b/app/views/bixes/items.html.erb
@@ -0,0 +1,122 @@
+
Mudar compras de <%= @bixe.nome %>
+
+
+<%= form_tag do %>
+
Produtos do Kit Bixe
+
+
+ -1
+
+ +1
+
+
+ <% Item.all.each do |it| %>
+ <% if it.eh_do_kit %>
+
-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/bixes/new.html.erb b/app/views/bixes/new.html.erb
new file mode 100644
index 0000000..efb4f6b
--- /dev/null
+++ b/app/views/bixes/new.html.erb
@@ -0,0 +1,3 @@
+
Novo bixe
+
+<%= render 'form', bixe: @bixe %>
\ No newline at end of file
diff --git a/app/views/bixes/show.html.erb b/app/views/bixes/show.html.erb
new file mode 100644
index 0000000..786067d
--- /dev/null
+++ b/app/views/bixes/show.html.erb
@@ -0,0 +1,71 @@
+
+
\ No newline at end of file
diff --git a/app/views/items/_form.html.erb b/app/views/items/_form.html.erb
new file mode 100644
index 0000000..c2fc8d2
--- /dev/null
+++ b/app/views/items/_form.html.erb
@@ -0,0 +1,47 @@
+<%= form_with(model: item, local: true) do |form| %>
+ <% if item.errors.any? %>
+
+
<%= pluralize(item.errors.count, "error") %> erro(s) impediram a operação:
+
+
+ <% item.errors.full_messages.each do |message| %>
+
-<% end %>
+<% end %>
\ No newline at end of file
diff --git a/app/views/modalidades/contatos.html.erb b/app/views/modalidades/contatos.html.erb
index 0edc787..5b2ba33 100644
--- a/app/views/modalidades/contatos.html.erb
+++ b/app/views/modalidades/contatos.html.erb
@@ -1,4 +1,3 @@
-
Contatos por modalidade
E-mails
@@ -6,10 +5,9 @@
<% @modalidades.each do |m| %>
# <%= m.nome %>
-<% m.bixos.each do |b| %>
+<% m.bixes.each do |b| %>
<%= b.email %>
<% end %>
-
<% end %>
@@ -18,10 +16,8 @@
<% @modalidades.each do |m| %>
# <%= m.nome %>
-<% m.bixos.each do |b| %>
+<% m.bixes.each do |b| %>
<%= b.telefone %> <%= b.nome %>
<% end %>
-
<% end %>
-
-
+
\ No newline at end of file
diff --git a/app/views/modalidades/edit.html.erb b/app/views/modalidades/edit.html.erb
index 68e959e..9cf3b73 100644
--- a/app/views/modalidades/edit.html.erb
+++ b/app/views/modalidades/edit.html.erb
@@ -1,6 +1,5 @@
Editing Modalidade
<%= render 'form', modalidade: @modalidade %>
-
<%= link_to 'Show', @modalidade %> |
-<%= link_to 'Back', modalidades_path %>
+<%= link_to 'Back', modalidades_path %>
\ No newline at end of file
diff --git a/app/views/modalidades/index.html.erb b/app/views/modalidades/index.html.erb
index 59877e8..888e604 100644
--- a/app/views/modalidades/index.html.erb
+++ b/app/views/modalidades/index.html.erb
@@ -1,4 +1,3 @@
-
Modalidades da AAAMat
@@ -19,4 +18,4 @@
<% end %>
<% end %>
-
+
\ No newline at end of file
diff --git a/app/views/modalidades/new.html.erb b/app/views/modalidades/new.html.erb
index 53a11bc..e2444dd 100644
--- a/app/views/modalidades/new.html.erb
+++ b/app/views/modalidades/new.html.erb
@@ -1,5 +1,4 @@
Nova Modalidade
<%= render 'form', modalidade: @modalidade %>
-
-<%= link_to 'Voltar', modalidades_path %>
+<%= link_to 'Voltar', modalidades_path %>
\ No newline at end of file
diff --git a/app/views/modalidades/show.html.erb b/app/views/modalidades/show.html.erb
index f75bdd3..9bcf4cd 100644
--- a/app/views/modalidades/show.html.erb
+++ b/app/views/modalidades/show.html.erb
@@ -19,9 +19,9 @@
Bixos na modalidade
- <% @modalidade.bixos.each_with_index do |b, i| %>
+ <% @modalidade.bixes.each_with_index do |b, i| %>
- <%= link_to bixo_path(b.id) do %>
+ <%= link_to bixe_path(b.id) do %>
-
diff --git a/bin/bundle b/bin/bundle
deleted file mode 100755
index 66e9889..0000000
--- a/bin/bundle
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/usr/bin/env ruby
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
-load Gem.bin_path('bundler', 'bundle')
diff --git a/bin/rails b/bin/rails
index 5badb2f..efc0377 100755
--- a/bin/rails
+++ b/bin/rails
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
-APP_PATH = File.expand_path('../config/application', __dir__)
-require_relative '../config/boot'
-require 'rails/commands'
+APP_PATH = File.expand_path("../config/application", __dir__)
+require_relative "../config/boot"
+require "rails/commands"
diff --git a/bin/rake b/bin/rake
index d87d5f5..4fbf10b 100755
--- a/bin/rake
+++ b/bin/rake
@@ -1,9 +1,4 @@
#!/usr/bin/env ruby
-begin
- load File.expand_path('../spring', __FILE__)
-rescue LoadError => e
- raise unless e.message.include?('spring')
-end
-require_relative '../config/boot'
-require 'rake'
+require_relative "../config/boot"
+require "rake"
Rake.application.run
diff --git a/bin/setup b/bin/setup
index 78c4e86..ec47b79 100755
--- a/bin/setup
+++ b/bin/setup
@@ -1,38 +1,33 @@
#!/usr/bin/env ruby
-require 'pathname'
-require 'fileutils'
-include FileUtils
+require "fileutils"
# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
+APP_ROOT = File.expand_path("..", __dir__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
-chdir APP_ROOT do
- # This script is a starting point to setup your application.
+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')
-
- # Install JavaScript dependencies if using Yarn
- # system('bin/yarn')
-
+ 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')
- # cp 'config/database.yml.sample', 'config/database.yml'
+ # unless File.exist?("config/database.yml")
+ # FileUtils.cp "config/database.yml.sample", "config/database.yml"
# end
puts "\n== Preparing database =="
- system! 'bin/rails db:setup'
+ system! "bin/rails db:prepare"
puts "\n== Removing old logs and tempfiles =="
- system! 'bin/rails log:clear tmp:clear'
+ system! "bin/rails log:clear tmp:clear"
puts "\n== Restarting application server =="
- system! 'bin/rails restart'
+ system! "bin/rails restart"
end
diff --git a/bin/spring b/bin/spring
deleted file mode 100755
index fb2ec2e..0000000
--- a/bin/spring
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env ruby
-
-# This file loads spring without using Bundler, in order to be fast.
-# It gets overwritten when you run the `spring binstub` command.
-
-unless defined?(Spring)
- require 'rubygems'
- require 'bundler'
-
- lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
- spring = lockfile.specs.detect { |spec| spec.name == "spring" }
- if spring
- Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
- gem 'spring', spring.version
- require 'spring/binstub'
- end
-end
diff --git a/bin/update b/bin/update
deleted file mode 100755
index a8e4462..0000000
--- a/bin/update
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env ruby
-require 'pathname'
-require 'fileutils'
-include FileUtils
-
-# path to your application root.
-APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
-
-def system!(*args)
- system(*args) || abort("\n== Command #{args} failed ==")
-end
-
-chdir APP_ROOT do
- # This script is a way to update your development environment automatically.
- # Add necessary update steps to this file.
-
- puts '== Installing dependencies =='
- system! 'gem install bundler --conservative'
- system('bundle check') || system!('bundle install')
-
- puts "\n== Updating database =="
- system! 'bin/rails db:migrate'
-
- puts "\n== Removing old logs and tempfiles =="
- system! 'bin/rails log:clear tmp:clear'
-
- puts "\n== Restarting application server =="
- system! 'bin/rails restart'
-end
diff --git a/bin/yarn b/bin/yarn
deleted file mode 100755
index c2bacef..0000000
--- a/bin/yarn
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/usr/bin/env ruby
-VENDOR_PATH = File.expand_path('..', __dir__)
-Dir.chdir(VENDOR_PATH) do
- begin
- exec "yarnpkg #{ARGV.join(" ")}"
- rescue Errno::ENOENT
- $stderr.puts "Yarn executable was not detected in the system."
- $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
- exit 1
- end
-end
diff --git a/circle.yml b/circle.yml
deleted file mode 100644
index b628884..0000000
--- a/circle.yml
+++ /dev/null
@@ -1,12 +0,0 @@
-steps:
- - run: bundle exec rspec --format documentation
-
-deployment:
- staging:
- branch: master
- heroku:
- appname: kitbixo-imeusp
- commands:
- - rspec
- - git push git@heroku.com:kitbixo-imeusp.git $CIRCLE_SHA1:master
- - heroku run rake db:migrate --app kitbixo-imeusp
diff --git a/config.ru b/config.ru
index f7ba0b5..4a3c09a 100644
--- a/config.ru
+++ b/config.ru
@@ -1,5 +1,6 @@
# This file is used by Rack-based servers to start the application.
-require_relative 'config/environment'
+require_relative "config/environment"
run Rails.application
+Rails.application.load_server
diff --git a/config/application.rb b/config/application.rb
index dc41907..08827dd 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -1,33 +1,22 @@
-require_relative 'boot'
+require_relative "boot"
-require "rails"
-# Pick the frameworks you want:
-require "active_model/railtie"
-require "active_job/railtie"
-require "active_record/railtie"
-require "action_controller/railtie"
-require "action_mailer/railtie"
-require "action_view/railtie"
-require "action_cable/engine"
+require "rails/all"
require "sprockets/railtie"
-# require "rails/test_unit/railtie"
-
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
-module Kitbixo
+module App
class Application < Rails::Application
# Initialize configuration defaults for originally generated Rails version.
- config.load_defaults 5.1
-
- # Settings in config/environments/* take precedence over those specified here.
- # Application configuration should go into files in config/initializers
- # -- all .rb files in that directory are automatically loaded.
-
- # Don't generate system test files.
- config.generators.system_tests = nil
+ config.load_defaults 7.0
- config.x.preco = ENV['PRECO'].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
diff --git a/config/boot.rb b/config/boot.rb
index 30f5120..988a5dd 100644
--- a/config/boot.rb
+++ b/config/boot.rb
@@ -1,3 +1,4 @@
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
+ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
-require 'bundler/setup' # Set up gems listed in the Gemfile.
+require "bundler/setup" # Set up gems listed in the Gemfile.
+require "bootsnap/setup" # Speed up boot time by caching expensive operations.
diff --git a/config/cable.yml b/config/cable.yml
index a733b67..f39dc04 100644
--- a/config/cable.yml
+++ b/config/cable.yml
@@ -2,9 +2,9 @@ development:
adapter: async
test:
- adapter: async
+ adapter: test
production:
adapter: redis
- url: redis://localhost:6379/1
- channel_prefix: kitbixo_production
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
+ channel_prefix: app_production
diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc
new file mode 100644
index 0000000..22e0266
--- /dev/null
+++ b/config/credentials.yml.enc
@@ -0,0 +1 @@
+OubihX29sdtvfH5D3iff+MmJPsG/eVhWuUkk1yYr38u4KucJylvi8oiCe9o+GRvSnbsPiNo7Xlk9XqHa49OQQwL88Ji2Emyn7WTp+mKZr+QBpMzAjXs8FyfOMa46rK4Sq+JsjP9UoH1lS6vZgQjhjT1z4tBj83MsgNk2/LJYP5TreZJItDtWw07SAZwpPgvvX9mgKKU/7IFCIILhwij+y4bb+Qaod+Yizmb3mQiUx4epVeN1O/5tkCgEv+4z5T0dghOXWtgj8hS09OU31wZsIjbrav65Hg69luJ2cxs0NzYw1PDH5wv+GzXPPja97gt4bSORBImxJxvNGzC5i64NXKEw1tFx2cD3hASIoZdmghpey6Dg6c9T07gejLcrV3gpQF/BTeuis04nJdnq95YK51S/0Crrgox2mzQb--oXco45FN53bP66WV--lFYlwWy96g1qN0iZBomjOA==
\ No newline at end of file
diff --git a/config/database.yml b/config/database.yml
index b2effdc..8b8c6b9 100644
--- a/config/database.yml
+++ b/config/database.yml
@@ -1,22 +1,28 @@
+# 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
- host: localhost
adapter: postgresql
- username: postgres
- password: postgres
+ encoding: unicode
+ host: <%= ENV['POSTGRES_HOST'] %>
+ username: <%= ENV['POSTGRES_USER'] %>
+ password: <%= ENV['POSTGRES_PASSWORD'] %>
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
- timeout: 5000
development:
<<: *default
- database: development
+ database: <%= ENV['POSTGRES_DB'] %>
# 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: kitbixo_test
+ database: test
production:
<<: *default
- database: production
+ database: <%= ENV['POSTGRES_DB'] %>
diff --git a/config/environment.rb b/config/environment.rb
index 426333b..cac5315 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -1,5 +1,5 @@
# Load the Rails application.
-require_relative 'application'
+require_relative "application"
# Initialize the Rails application.
Rails.application.initialize!
diff --git a/config/environments/development.rb b/config/environments/development.rb
index 5187e22..8500f45 100644
--- a/config/environments/development.rb
+++ b/config/environments/development.rb
@@ -1,8 +1,10 @@
+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 on
- # every request. This slows down response time but is perfect for development
+ # 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
@@ -12,13 +14,18 @@
# 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.
- if Rails.root.join('tmp/caching-dev.txt').exist?
+ # 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.seconds.to_i}"
+ "Cache-Control" => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
@@ -26,6 +33,9 @@
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
@@ -34,21 +44,27 @@
# 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
- # Debug mode disables concatenation and preprocessing of assets.
- # This option may cause significant delays in view rendering with a large
- # number of complex assets.
- config.assets.debug = true
+ # Highlight code that triggered database queries in logs.
+ config.active_record.verbose_query_logs = true
# Suppress logger output for asset requests.
config.assets.quiet = true
- # Raises error for missing translations
- # config.action_view.raise_on_missing_translations = 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
- # Use an evented file watcher to asynchronously detect changes in source code,
- # routes, locales, etc. This feature depends on the listen gem.
- config.file_watcher = ActiveSupport::EventedFileUpdateChecker
+ # Uncomment if you wish to allow Action Cable access from any origin.
+ # config.action_cable.disable_request_forgery_protection = true
end
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 3c08832..ab507d3 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -1,3 +1,5 @@
+require "active_support/core_ext/integer/time"
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@@ -14,43 +16,42 @@
config.consider_all_requests_local = false
config.action_controller.perform_caching = true
- # Attempt to read encrypted secrets from `config/secrets.yml.enc`.
- # Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
- # `config/secrets.yml.key`.
- config.read_encrypted_secrets = true
+ # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
+ # or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
+ # config.require_master_key = true
# Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this.
- config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
+ config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
- # Compress JavaScripts and CSS.
- config.assets.js_compressor = :uglifier
+ # Compress CSS using a preprocessor.
# config.assets.css_compressor = :sass
- # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.initialize_on_precompile = false
+ # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false
- # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
- # config.action_controller.asset_host = 'http://assets.example.com'
+ # config.asset_host = "http://assets.example.com"
# Specifies the header that your server uses for sending files.
- # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
+ # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for Apache
+ # config.action_dispatch.x_sendfile_header = "X-Accel-Redirect" # for NGINX
+
+ # Store uploaded files on the local file system (see config/storage.yml for options).
+ config.active_storage.service = :local
- # Mount Action Cable outside main process or domain
+ # Mount Action Cable outside main process or domain.
# config.action_cable.mount_path = nil
- # config.action_cable.url = 'wss://example.com/cable'
- # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
+ # config.action_cable.url = "wss://example.com/cable"
+ # config.action_cable.allowed_request_origins = [ "http://example.com", /http:\/\/example.*/ ]
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true
- # Use the lowest log level to ensure availability of diagnostic information
- # when problems arise.
- config.log_level = :debug
+ # Include generic and useful information about system operation, but avoid logging too much
+ # information to avoid inadvertent exposure of personally identifiable information (PII).
+ config.log_level = :info
# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
@@ -58,9 +59,10 @@
# Use a different cache store in production.
# config.cache_store = :mem_cache_store
- # Use a real queuing backend for Active Job (and separate queues per environment)
+ # Use a real queuing backend for Active Job (and separate queues per environment).
# config.active_job.queue_adapter = :resque
- # config.active_job.queue_name_prefix = "kitbixo_#{Rails.env}"
+ # config.active_job.queue_name_prefix = "app_production"
+
config.action_mailer.perform_caching = false
# Ignore bad email addresses and do not raise email delivery errors.
@@ -71,15 +73,15 @@
# the I18n.default_locale when a translation cannot be found).
config.i18n.fallbacks = true
- # Send deprecation notices to registered listeners.
- config.active_support.deprecation = :notify
+ # Don't log any deprecations.
+ config.active_support.report_deprecations = false
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups.
- # require 'syslog/logger'
- # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
+ # require "syslog/logger"
+ # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new "app-name")
if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT)
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 8e5cbde..6ea4d1e 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,32 +1,41 @@
+require "active_support/core_ext/integer/time"
+
+# The test environment is used exclusively to run your application's
+# test suite. You never need to work with it otherwise. Remember that
+# your test database is "scratch space" for the test suite and is wiped
+# and recreated between test runs. Don't rely on the data there!
+
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
- # The test environment is used exclusively to run your application's
- # test suite. You never need to work with it otherwise. Remember that
- # your test database is "scratch space" for the test suite and is wiped
- # and recreated between test runs. Don't rely on the data there!
+ # Turn false under Spring and add config.action_view.cache_template_loading = true.
config.cache_classes = true
- # Do not eager load code on boot. This avoids loading your whole application
- # just for the purpose of running a single test. If you are using a tool that
- # preloads Rails for running tests, you may have to set it to true.
- config.eager_load = false
+ # Eager loading loads your whole application. When running a single test locally,
+ # this probably isn't necessary. It's a good idea to do in a continuous integration
+ # system, or in some way before deploying your code.
+ config.eager_load = ENV["CI"].present?
# Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true
config.public_file_server.headers = {
- 'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
+ "Cache-Control" => "public, max-age=#{1.hour.to_i}"
}
# Show full error reports and disable caching.
config.consider_all_requests_local = true
config.action_controller.perform_caching = false
+ config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment.
config.action_controller.allow_forgery_protection = false
+
+ # Store uploaded files on the local file system in a temporary directory.
+ config.active_storage.service = :test
+
config.action_mailer.perform_caching = false
# Tell Action Mailer not to deliver emails to the real world.
@@ -37,6 +46,15 @@
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
- # Raises error for missing translations
- # config.action_view.raise_on_missing_translations = true
+ # 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 = []
+
+ # 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
end
diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb
deleted file mode 100644
index 89d2efa..0000000
--- a/config/initializers/application_controller_renderer.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# ActiveSupport::Reloader.to_prepare do
-# ApplicationController.renderer.defaults.merge!(
-# http_host: 'example.org',
-# https: false
-# )
-# end
diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb
index 4b828e8..2eeef96 100644
--- a/config/initializers/assets.rb
+++ b/config/initializers/assets.rb
@@ -1,12 +1,10 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
-Rails.application.config.assets.version = '1.0'
+Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path
-# Add Yarn node_modules folder to the asset load path.
-Rails.application.config.assets.paths << Rails.root.join('node_modules')
# Precompile additional assets.
# application.js, application.css, and all non-JS/CSS in the app/assets
diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb
deleted file mode 100644
index 59385cd..0000000
--- a/config/initializers/backtrace_silencers.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
-# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
-
-# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
-# Rails.backtrace_cleaner.remove_silencers!
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
new file mode 100644
index 0000000..3621f97
--- /dev/null
+++ b/config/initializers/content_security_policy.rb
@@ -0,0 +1,26 @@
+# Be sure to restart your server when you modify this file.
+
+# Define an application-wide content security policy
+# For further information see the following documentation
+# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
+
+# Rails.application.configure do
+# config.content_security_policy do |policy|
+# policy.default_src :self, :https
+# policy.font_src :self, :https, :data
+# policy.img_src :self, :https, :data
+# policy.object_src :none
+# policy.script_src :self, :https
+# policy.style_src :self, :https
+# # Specify URI for violation reports
+# # policy.report_uri "/csp-violation-report-endpoint"
+# end
+#
+# # Generate session nonces for permitted importmap and inline scripts
+# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
+# config.content_security_policy_nonce_directives = %w(script-src)
+#
+# # Report CSP violations to a specified URI. See:
+# # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
+# # config.content_security_policy_report_only = true
+# end
diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb
deleted file mode 100644
index 5a6a32d..0000000
--- a/config/initializers/cookies_serializer.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Specify a serializer for the signed and encrypted cookie jars.
-# Valid options are :json, :marshal, and :hybrid.
-Rails.application.config.action_dispatch.cookies_serializer = :json
diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb
index 4a994e1..adc6568 100644
--- a/config/initializers/filter_parameter_logging.rb
+++ b/config/initializers/filter_parameter_logging.rb
@@ -1,4 +1,8 @@
# Be sure to restart your server when you modify this file.
-# Configure sensitive parameters which will be filtered from the log file.
-Rails.application.config.filter_parameters += [:password]
+# Configure parameters to be filtered from the log file. Use this to limit dissemination of
+# sensitive information. See the ActiveSupport::ParameterFilter documentation for supported
+# notations and behaviors.
+Rails.application.config.filter_parameters += [
+ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
+]
diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb
index ac033bf..66b741e 100644
--- a/config/initializers/inflections.rb
+++ b/config/initializers/inflections.rb
@@ -4,13 +4,17 @@
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
-# inflect.plural /^(ox)$/i, '\1en'
-# inflect.singular /^(ox)en/i, '\1'
-# inflect.irregular 'person', 'people'
+# inflect.plural /^(ox)$/i, "\\1en"
+# inflect.singular /^(ox)en/i, "\\1"
+# inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
-# inflect.acronym 'RESTful'
+# inflect.acronym "RESTful"
# end
+ActiveSupport::Inflector.inflections(:en) do |inflect|
+ inflect.irregular "bixe", "bixes"
+ inflect.irregular "confirmacao", "confirmacoes"
+end
\ No newline at end of file
diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb
deleted file mode 100644
index dc18996..0000000
--- a/config/initializers/mime_types.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Add new mime types for use in respond_to blocks:
-# Mime::Type.register "text/richtext", :rtf
diff --git a/config/initializers/permissions_policy.rb b/config/initializers/permissions_policy.rb
new file mode 100644
index 0000000..00f64d7
--- /dev/null
+++ b/config/initializers/permissions_policy.rb
@@ -0,0 +1,11 @@
+# Define an application-wide HTTP permissions policy. For further
+# information see https://developers.google.com/web/updates/2018/06/feature-policy
+#
+# Rails.application.config.permissions_policy do |f|
+# f.camera :none
+# f.gyroscope :none
+# f.microphone :none
+# f.usb :none
+# f.fullscreen :self
+# f.payment :self, "https://secure.example.com"
+# end
diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb
deleted file mode 100644
index bbfc396..0000000
--- a/config/initializers/wrap_parameters.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# This file contains settings for ActionController::ParamsWrapper which
-# is enabled by default.
-
-# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
-ActiveSupport.on_load(:action_controller) do
- wrap_parameters format: [:json]
-end
-
-# To enable root element in JSON for ActiveRecord objects.
-# ActiveSupport.on_load(:active_record) do
-# self.include_root_in_json = true
-# end
diff --git a/config/locales/en.yml b/config/locales/en.yml
index decc5a8..8ca56fc 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -4,11 +4,11 @@
#
# To use the locales, use `I18n.t`:
#
-# I18n.t 'hello'
+# I18n.t "hello"
#
# In views, this is aliased to just `t`:
#
-# <%= t('hello') %>
+# <%= t("hello") %>
#
# To use a different locale, set it with `I18n.locale`:
#
@@ -24,10 +24,10 @@
# Instead, surround them with single quotes.
#
# en:
-# 'true': 'foo'
+# "true": "foo"
#
# To learn more, please read the Rails Internationalization guide
-# available at http://guides.rubyonrails.org/i18n.html.
+# available at https://guides.rubyonrails.org/i18n.html.
en:
hello: "Hello world"
diff --git a/config/puma.rb b/config/puma.rb
index 1e19380..daaf036 100644
--- a/config/puma.rb
+++ b/config/puma.rb
@@ -4,19 +4,28 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
-threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
-threads threads_count, threads_count
+max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
+min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
+threads min_threads_count, max_threads_count
+
+# Specifies the `worker_timeout` threshold that Puma will use to wait before
+# terminating a worker in development environments.
+#
+worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
-port ENV.fetch("PORT") { 3000 }
+port ENV.fetch("PORT") { 3000 }
# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }
+# Specifies the `pidfile` that Puma will use.
+pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
+
# Specifies the number of `workers` to boot in clustered mode.
-# Workers are forked webserver processes. If using threads and workers together
+# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
@@ -26,31 +35,9 @@
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
-# process behavior so workers use less memory. If you use this option
-# you need to make sure to reconnect any threads in the `on_worker_boot`
-# block.
+# process behavior so workers use less memory.
#
# preload_app!
-# If you are preloading your application and using Active Record, it's
-# recommended that you close any connections to the database before workers
-# are forked to prevent connection leakage.
-#
-# before_fork do
-# ActiveRecord::Base.connection_pool.disconnect! if defined?(ActiveRecord)
-# end
-
-# The code in the `on_worker_boot` will be called if you are using
-# clustered mode by specifying a number of `workers`. After each worker
-# process is booted, this block will be run. If you are using the `preload_app!`
-# option, you will want to use this block to reconnect to any threads
-# or connections that may have been created at application boot, as Ruby
-# cannot share connections between processes.
-#
-# on_worker_boot do
-# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
-# end
-#
-
-# Allow puma to be restarted by `rails restart` command.
+# Allow puma to be restarted by `bin/rails restart` command.
plugin :tmp_restart
diff --git a/config/routes.rb b/config/routes.rb
index 38b7037..336ecba 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,30 +1,28 @@
Rails.application.routes.draw do
- root to: 'bixos#index'
-
- resources :bixos, only: [] do
+ root to: 'bixes#index'
+ resources :bixes, only: [] do
collection do
- resources :confirmations, only: %i(index)
+ resources :confirmacoes, only: %i(index)
get :emails
end
member do
- resources :confirmations, only: %i(create)
+ resources :confirmacoes, only: %i(create)
end
end
- get '/bixos/contatos' => 'bixos#contatos', as: :contatos
- get '/bixos/:id/modalidades' => 'bixos#modalidades', as: :edit_bixo_modalidades
- post '/bixos/:id/modalidades' => 'bixos#modify_modalidades', as: :modify_bixo_modalidades
+ get '/bixes/contatos' => 'bixes#contatos', as: :contatos
+ get '/bixes/:id/modalidades' => 'bixes#modalidades', as: :edit_bixe_modalidades
+ get '/bixes/:id/items' => 'bixes#items', as: :edit_bixe_items
+ post '/bixes/:id/modalidades' => 'bixes#modify_modalidades', as: :modify_bixe_modalidades
+ post '/bixes/:id/items' => 'bixes#modify_items', as: :modify_bixe_items
get '/modalidades/contatos' => 'modalidades#contatos', as: :contato_modalidades
-
- get '/admin' => 'application#admin', as: :admin
- post '/admin/limpar_mochilas' => 'application#limpa_mochilas', as: :limpa_mochilas
- post '/admin/arruma_canecas' => 'application#arruma_canecas', as: :arruma_canecas
-
- resources :bixos, except: [:edit]
- resources :veteranos, except: [:show, :new]
+
+ get '/items/:id/bixes' => 'items#bixes', as: :edit_item_bixes
+ get '/items/contatos' => 'items#contatos', as: :contato_items
+ get '/items/planilha' => 'items#planilha', as: :planilha_items
+ resources :bixes, except: [:edit]
resources :modalidades
- resources :vendas, except: [:show, :new, :create]
- resources :pagamentos, except: [:show, :index, :new, :create]
+ resources :items
end
diff --git a/config/secrets.yml b/config/secrets.yml
deleted file mode 100644
index c2d15c2..0000000
--- a/config/secrets.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-# Be sure to restart your server when you modify this file.
-
-# Your secret key is used for verifying the integrity of signed cookies.
-# If you change this key, all old signed cookies will become invalid!
-
-# Make sure the secret is at least 30 characters and all random,
-# no regular words or you'll be exposed to dictionary attacks.
-# You can use `rails secret` to generate a secure secret key.
-
-# Make sure the secrets in this file are kept private
-# if you're sharing your code publicly.
-
-# Shared secrets are available across all environments.
-
-# shared:
-# api_key: a1B2c3D4e5F6
-
-# Environmental secrets are only available for that specific environment.
-
-development:
- secret_key_base: e5cfd2678b6da1f420b8f1abc39a668dbc8f5d1290d3c0bcef7424185fa87b0f6ef846f4666011efba49e661add014020cb4cc18c19a545c60c128eaee9cfb91
-
-test:
- secret_key_base: b6ac52715ce5d25711677f9290c15d8d0b325bb8c50f0a1ace59b8257b5994ff7d6d800a533f749e4e43c0ea81aa1d5fdd657ee6e7d9821c91512ea76eec7f0f
-
-# Do not keep production secrets in the unencrypted secrets file.
-# Instead, either read values from the environment.
-# Or, use `bin/rails secrets:setup` to configure encrypted secrets
-# and move the `production:` environment over there.
-
-production:
- secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
diff --git a/config/spring.rb b/config/spring.rb
deleted file mode 100644
index c9119b4..0000000
--- a/config/spring.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-%w(
- .ruby-version
- .rbenv-vars
- tmp/restart.txt
- tmp/caching-dev.txt
-).each { |path| Spring.watch(path) }
diff --git a/config/storage.yml b/config/storage.yml
new file mode 100644
index 0000000..4942ab6
--- /dev/null
+++ b/config/storage.yml
@@ -0,0 +1,34 @@
+test:
+ service: Disk
+ root: <%= Rails.root.join("tmp/storage") %>
+
+local:
+ service: Disk
+ root: <%= Rails.root.join("storage") %>
+
+# Use bin/rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
+# amazon:
+# service: S3
+# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
+# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
+# region: us-east-1
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Remember not to checkin your GCS keyfile to a repository
+# google:
+# service: GCS
+# project: your_project
+# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
+# bucket: your_own_bucket-<%= Rails.env %>
+
+# Use bin/rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
+# microsoft:
+# service: AzureStorage
+# storage_account_name: your_account_name
+# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
+# container: your_container_name-<%= Rails.env %>
+
+# mirror:
+# service: Mirror
+# primary: local
+# mirrors: [ amazon, google, microsoft ]
diff --git a/db/migrate/20171203155057_create_bixos_modalidades_table.rb b/db/migrate/20171203155057_create_bixos_modalidades_table.rb
deleted file mode 100644
index 936e253..0000000
--- a/db/migrate/20171203155057_create_bixos_modalidades_table.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class CreateBixosModalidadesTable < ActiveRecord::Migration[5.1]
- def change
- create_table :bixos_modalidades, id: false do |t|
- t.belongs_to :bixo, index: true
- t.belongs_to :modalidade, index: true
- end
- end
-end
diff --git a/db/migrate/20180205160823_create_vendas.rb b/db/migrate/20180205160823_create_vendas.rb
deleted file mode 100644
index dfc0780..0000000
--- a/db/migrate/20180205160823_create_vendas.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class CreateVendas < ActiveRecord::Migration[5.1]
- def change
- create_table :vendas do |t|
- t.string :tamanho, default: "M", null: false
- t.string :cor, default: "Vermelha", null: false
- t.belongs_to :bixo, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20180208165302_create_pagamentos.rb b/db/migrate/20180208165302_create_pagamentos.rb
deleted file mode 100644
index 3782066..0000000
--- a/db/migrate/20180208165302_create_pagamentos.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-class CreatePagamentos < ActiveRecord::Migration[5.1]
- def change
- create_table :pagamentos do |t|
- t.decimal :valor
- t.belongs_to :venda, index: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20180208185214_create_veteranos.rb b/db/migrate/20180208185214_create_veteranos.rb
deleted file mode 100644
index 90abf3b..0000000
--- a/db/migrate/20180208185214_create_veteranos.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateVeteranos < ActiveRecord::Migration[5.1]
- def change
- create_table :veteranos do |t|
- t.string :nome
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20180208185534_add_veterano_column_to_pagamentos.rb b/db/migrate/20180208185534_add_veterano_column_to_pagamentos.rb
deleted file mode 100644
index 56f1aed..0000000
--- a/db/migrate/20180208185534_add_veterano_column_to_pagamentos.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddVeteranoColumnToPagamentos < ActiveRecord::Migration[5.1]
- def change
- add_reference :pagamentos, :veterano, foreign_key: true
- end
-end
diff --git a/db/migrate/20180210141332_drop_columns_from_vendas.rb b/db/migrate/20180210141332_drop_columns_from_vendas.rb
deleted file mode 100644
index ffe8022..0000000
--- a/db/migrate/20180210141332_drop_columns_from_vendas.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class DropColumnsFromVendas < ActiveRecord::Migration[5.1]
- def change
- remove_column :vendas, :cor
- remove_column :vendas, :tamanho
- end
-end
diff --git a/db/migrate/20180210141445_create_cor_and_tamanho_columns_as_int.rb b/db/migrate/20180210141445_create_cor_and_tamanho_columns_as_int.rb
deleted file mode 100644
index 58e0c36..0000000
--- a/db/migrate/20180210141445_create_cor_and_tamanho_columns_as_int.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class CreateCorAndTamanhoColumnsAsInt < ActiveRecord::Migration[5.1]
- def change
- add_column :vendas, :cor, :integer
- add_column :vendas, :tamanho, :integer
- end
-end
diff --git a/db/migrate/20180215102940_add_caneca_column_to_bixo.rb b/db/migrate/20180215102940_add_caneca_column_to_bixo.rb
deleted file mode 100644
index ab7fe90..0000000
--- a/db/migrate/20180215102940_add_caneca_column_to_bixo.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddCanecaColumnToBixo < ActiveRecord::Migration[5.1]
- def change
- add_column :bixos, :caneca, :boolean, default: false
- end
-end
diff --git a/db/migrate/20180215104914_add_caneca_to_venda.rb b/db/migrate/20180215104914_add_caneca_to_venda.rb
deleted file mode 100644
index e1a84a6..0000000
--- a/db/migrate/20180215104914_add_caneca_to_venda.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-class AddCanecaToVenda < ActiveRecord::Migration[5.1]
- def change
- remove_column :bixos, :caneca
- add_column :vendas, :caneca, :boolean
- end
-end
diff --git a/db/migrate/20190214185449_add_tutorship_column_to_bixos.rb b/db/migrate/20190214185449_add_tutorship_column_to_bixos.rb
deleted file mode 100644
index 73d24cc..0000000
--- a/db/migrate/20190214185449_add_tutorship_column_to_bixos.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class AddTutorshipColumnToBixos < ActiveRecord::Migration[5.1]
- def change
- add_column :bixos, :tutorship, :boolean, default: false
- end
-end
diff --git a/db/migrate/20190214193750_create_confirmations.rb b/db/migrate/20190214193750_create_confirmations.rb
deleted file mode 100644
index 5d27e81..0000000
--- a/db/migrate/20190214193750_create_confirmations.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class CreateConfirmations < ActiveRecord::Migration[5.1]
- def change
- create_table :confirmations do |t|
- t.references :bixo, foreign_key: true
-
- t.timestamps
- end
- end
-end
diff --git a/db/migrate/20171005172531_create_bixos.rb b/db/migrate/20220313221143_create_bixes.rb
similarity index 63%
rename from db/migrate/20171005172531_create_bixos.rb
rename to db/migrate/20220313221143_create_bixes.rb
index 8cd61b8..51abc80 100644
--- a/db/migrate/20171005172531_create_bixos.rb
+++ b/db/migrate/20220313221143_create_bixes.rb
@@ -1,6 +1,6 @@
-class CreateBixos < ActiveRecord::Migration[5.1]
+class CreateBixes < ActiveRecord::Migration[7.0]
def change
- create_table :bixos do |t|
+ create_table :bixes do |t|
t.string :nome
t.string :email
t.string :telefone
diff --git a/db/migrate/20171202232819_create_modalidades.rb b/db/migrate/20220313221313_create_modalidades.rb
similarity index 66%
rename from db/migrate/20171202232819_create_modalidades.rb
rename to db/migrate/20220313221313_create_modalidades.rb
index ca2e2b1..1c51dba 100644
--- a/db/migrate/20171202232819_create_modalidades.rb
+++ b/db/migrate/20220313221313_create_modalidades.rb
@@ -1,4 +1,4 @@
-class CreateModalidades < ActiveRecord::Migration[5.1]
+class CreateModalidades < ActiveRecord::Migration[7.0]
def change
create_table :modalidades do |t|
t.string :nome
diff --git a/db/migrate/20220313221535_create_confirmacoes.rb b/db/migrate/20220313221535_create_confirmacoes.rb
new file mode 100644
index 0000000..573caa5
--- /dev/null
+++ b/db/migrate/20220313221535_create_confirmacoes.rb
@@ -0,0 +1,9 @@
+class CreateConfirmacoes < ActiveRecord::Migration[7.0]
+ def change
+ create_table :confirmacoes do |t|
+ t.references :bixe, null: false, foreign_key: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20220314002825_create_bixes_modalidades_table.rb b/db/migrate/20220314002825_create_bixes_modalidades_table.rb
new file mode 100644
index 0000000..49420c0
--- /dev/null
+++ b/db/migrate/20220314002825_create_bixes_modalidades_table.rb
@@ -0,0 +1,10 @@
+class CreateBixesModalidadesTable < ActiveRecord::Migration[7.0]
+ def change
+ create_table :bixes_modalidades do |t|
+ t.references :bixe, null: false, foreign_key: true, index: true
+ t.references :modalidade, null: false, foreign_key: true, index: true
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20230308204741_items.rb b/db/migrate/20230308204741_items.rb
new file mode 100644
index 0000000..d9f5cb1
--- /dev/null
+++ b/db/migrate/20230308204741_items.rb
@@ -0,0 +1,12 @@
+class Items < ActiveRecord::Migration[7.0]
+ def change
+ create_table :items do |t|
+ t.string :nome
+ t.numeric :preco
+ t.numeric :quantidade
+ t.boolean :eh_do_kit
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20230308205332_create_bixes_items_table.rb b/db/migrate/20230308205332_create_bixes_items_table.rb
new file mode 100644
index 0000000..a3f107b
--- /dev/null
+++ b/db/migrate/20230308205332_create_bixes_items_table.rb
@@ -0,0 +1,11 @@
+class CreateBixesItemsTable < ActiveRecord::Migration[7.0]
+ def change
+ create_table :bixes_items do |t|
+ t.references :bixe, null: false, foreign_key: true, index: true
+ t.references :item, null: false, foreign_key: true, index: true
+
+ t.integer :quantity, null: false, default: 0
+ t.timestamps
+ end
+ end
+end
diff --git a/db/migrate/20240206184442_create_bixe_item.rb b/db/migrate/20240206184442_create_bixe_item.rb
new file mode 100644
index 0000000..88527db
--- /dev/null
+++ b/db/migrate/20240206184442_create_bixe_item.rb
@@ -0,0 +1,11 @@
+class CreateBixeItem < ActiveRecord::Migration[7.0]
+ def change
+ create_table :bixe_items do |t|
+ t.references :bixe, foreign_key: true
+ t.references :item, foreign_key: true
+ t.integer :quantity, null: false, default: 1
+
+ t.timestamps
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7058796..bc2c44c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -2,75 +2,83 @@
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
-# Note that this schema.rb definition is the authoritative source for your
-# database schema. If you need to create the application database on another
-# system, you should be using db:schema:load, not running all the migrations
-# from scratch. The latter is a flawed and unsustainable approach (the more migrations
-# you'll amass, the slower it'll run and the greater likelihood for issues).
+# This file is the source Rails uses to define your schema when running `bin/rails
+# db:schema:load`. When creating a new database, `bin/rails db:schema:load` tends to
+# be faster and is potentially less error prone than running all of your
+# migrations from scratch. Old migrations may fail to apply correctly if those
+# migrations use external dependencies or application code.
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20190214193750) do
-
+ActiveRecord::Schema[7.0].define(version: 2024_02_06_184442) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
- create_table "bixos", force: :cascade do |t|
+ create_table "bixe_items", force: :cascade do |t|
+ t.bigint "bixe_id"
+ t.bigint "item_id"
+ t.integer "quantity", default: 1, null: false
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ t.index ["bixe_id"], name: "index_bixe_items_on_bixe_id"
+ t.index ["item_id"], name: "index_bixe_items_on_item_id"
+ end
+
+ create_table "bixes", force: :cascade do |t|
t.string "nome"
t.string "email"
t.string "telefone"
t.integer "curso"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.boolean "tutorship", default: false
end
- create_table "bixos_modalidades", id: false, force: :cascade do |t|
- t.bigint "bixo_id"
- t.bigint "modalidade_id"
- t.index ["bixo_id"], name: "index_bixos_modalidades_on_bixo_id"
- t.index ["modalidade_id"], name: "index_bixos_modalidades_on_modalidade_id"
- end
-
- create_table "confirmations", force: :cascade do |t|
- t.bigint "bixo_id"
+ create_table "bixes_items", force: :cascade do |t|
+ t.bigint "bixe_id", null: false
+ t.bigint "item_id", null: false
+ t.integer "quantity", default: 0, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.index ["bixo_id"], name: "index_confirmations_on_bixo_id"
+ t.index ["bixe_id"], name: "index_bixes_items_on_bixe_id"
+ t.index ["item_id"], name: "index_bixes_items_on_item_id"
end
- create_table "modalidades", force: :cascade do |t|
- t.string "nome"
+ create_table "bixes_modalidades", force: :cascade do |t|
+ t.bigint "bixe_id", null: false
+ t.bigint "modalidade_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.index ["bixe_id"], name: "index_bixes_modalidades_on_bixe_id"
+ t.index ["modalidade_id"], name: "index_bixes_modalidades_on_modalidade_id"
end
- create_table "pagamentos", force: :cascade do |t|
- t.decimal "valor"
- t.bigint "venda_id"
+ create_table "confirmacoes", force: :cascade do |t|
+ t.bigint "bixe_id", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.bigint "veterano_id"
- t.index ["venda_id"], name: "index_pagamentos_on_venda_id"
- t.index ["veterano_id"], name: "index_pagamentos_on_veterano_id"
+ t.index ["bixe_id"], name: "index_confirmacoes_on_bixe_id"
end
- create_table "vendas", force: :cascade do |t|
- t.bigint "bixo_id"
+ create_table "items", force: :cascade do |t|
+ t.string "nome"
+ t.decimal "preco"
+ t.decimal "quantidade"
+ t.boolean "eh_do_kit"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
- t.integer "cor"
- t.integer "tamanho"
- t.boolean "caneca"
- t.index ["bixo_id"], name: "index_vendas_on_bixo_id"
end
- create_table "veteranos", force: :cascade do |t|
+ create_table "modalidades", force: :cascade do |t|
t.string "nome"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
- add_foreign_key "confirmations", "bixos"
- add_foreign_key "pagamentos", "veteranos"
+ add_foreign_key "bixe_items", "bixes"
+ add_foreign_key "bixe_items", "items"
+ add_foreign_key "bixes_items", "bixes"
+ add_foreign_key "bixes_items", "items"
+ add_foreign_key "bixes_modalidades", "bixes"
+ add_foreign_key "bixes_modalidades", "modalidades"
+ add_foreign_key "confirmacoes", "bixes"
end
diff --git a/db/seeds.rb b/db/seeds.rb
index b900844..bc25fce 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,9 +1,7 @@
# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
+# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Examples:
#
-# movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
-# Character.create(name: 'Luke', movie: movies.first)
-
-Veterano.create(nome: 'Wil')
+# movies = Movie.create([{ name: "Star Wars" }, { name: "Lord of the Rings" }])
+# Character.create(name: "Luke", movie: movies.first)
diff --git a/db/test.sqlite3 b/db/test.sqlite3
deleted file mode 100644
index 0a85486..0000000
Binary files a/db/test.sqlite3 and /dev/null differ
diff --git a/docker-compose.yaml b/docker-compose.yaml
new file mode 100644
index 0000000..44ee973
--- /dev/null
+++ b/docker-compose.yaml
@@ -0,0 +1,23 @@
+version: "3.7"
+
+services:
+ back:
+ build: .
+ ports:
+ - 3000:3000
+ volumes:
+ - ./:/usr/src/app
+ env_file:
+ - .env
+ depends_on:
+ - postgres
+
+ postgres:
+ image: postgres
+ env_file:
+ - .env
+ volumes:
+ - data:/var/lib/postgresql/data
+
+volumes:
+ data:
\ No newline at end of file
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100644
index 0000000..0721cd7
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+set -e
+
+# Remove a potentially pre-existing server.pid for Rails.
+rm -f /myapp/tmp/pids/server.pid
+
+# Then exec the container's main process (what's set as CMD in the Dockerfile).
+exec "$@"
\ No newline at end of file
diff --git a/app/assets/javascripts/channels/.keep b/log/.keep
similarity index 100%
rename from app/assets/javascripts/channels/.keep
rename to log/.keep
diff --git a/package.json b/package.json
deleted file mode 100644
index f75deff..0000000
--- a/package.json
+++ /dev/null
@@ -1,5 +0,0 @@
-{
- "name": "kitbixo",
- "private": true,
- "dependencies": {}
-}
diff --git a/process.yml b/process.yml
deleted file mode 100644
index 12364b7..0000000
--- a/process.yml
+++ /dev/null
@@ -1,185 +0,0 @@
-# Orb 'circleci/ruby@1.0' resolved to 'circleci/ruby@1.0.7'
-version: 2
-jobs:
- build:
- docker:
- - image: cimg/ruby:2.6-node
- steps:
- - checkout
- - restore_cache:
- keys:
- - gems-v1-{{ checksum "./Gemfile.lock" }}-{{ .Branch }}
- - gems-v1-{{ checksum "./Gemfile.lock" }}
- - run:
- command: |
- if test -f "Gemfile.lock"; then
- APP_BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")
- if [ -z "$APP_BUNDLER_VERSION" ]; then
- echo "Could not find bundler version from Gemfile.lock. Please use bundler-version parameter"
- else
- echo "Gemfile.lock is bundled with bundler version $APP_BUNDLER_VERSION"
- fi
- fi
-
- if ! [ -z ]; then
- echo "Found bundler-version parameter to override"
- APP_BUNDLER_VERSION=
- fi
-
- if ! echo $(bundle version) | grep -q $APP_BUNDLER_VERSION; then
- echo "Installing bundler $APP_BUNDLER_VERSION"
- gem install bundler:$APP_BUNDLER_VERSION
- else
- echo "bundler $APP_BUNDLER_VERSION is already installed."
- fi
-
- if "./vendor/bundle" == "./vendor/bundle"; then
- bundle check --path ./vendor/bundle || bundle install --deployment
- else
- bundle check --path ./vendor/bundle || bundle install --path=./vendor/bundle
- fi
- name: 'Bundle Install '
- - save_cache:
- key: gems-v1-{{ checksum "./Gemfile.lock" }}-{{ .Branch }}
- paths:
- - ./vendor/bundle
- test:
- parallelism: 3
- docker:
- - image: cimg/ruby:2.6-node
- - image: circleci/postgres:9.6.2-alpine
- environment:
- POSTGRES_USER: postgres
- POSTGRES_DB: kitbixo_test
- POSTGRES_PASSWORD: postgres
- environment:
- - BUNDLE_JOBS: '3'
- - BUNDLE_RETRY: '3'
- - PGHOST: 127.0.0.1
- - PGUSER: postgres
- - PGPASSWORD: postgres
- - RAILS_ENV: test
- steps:
- - checkout
- - restore_cache:
- keys:
- - gems-v1-{{ checksum "./Gemfile.lock" }}-{{ .Branch }}
- - gems-v1-{{ checksum "./Gemfile.lock" }}
- - run:
- command: |
- if test -f "Gemfile.lock"; then
- APP_BUNDLER_VERSION=$(cat Gemfile.lock | tail -1 | tr -d " ")
- if [ -z "$APP_BUNDLER_VERSION" ]; then
- echo "Could not find bundler version from Gemfile.lock. Please use bundler-version parameter"
- else
- echo "Gemfile.lock is bundled with bundler version $APP_BUNDLER_VERSION"
- fi
- fi
-
- if ! [ -z ]; then
- echo "Found bundler-version parameter to override"
- APP_BUNDLER_VERSION=
- fi
-
- if ! echo $(bundle version) | grep -q $APP_BUNDLER_VERSION; then
- echo "Installing bundler $APP_BUNDLER_VERSION"
- gem install bundler:$APP_BUNDLER_VERSION
- else
- echo "bundler $APP_BUNDLER_VERSION is already installed."
- fi
-
- if "./vendor/bundle" == "./vendor/bundle"; then
- bundle check --path ./vendor/bundle || bundle install --deployment
- else
- bundle check --path ./vendor/bundle || bundle install --path=./vendor/bundle
- fi
- name: 'Bundle Install '
- - save_cache:
- key: gems-v1-{{ checksum "./Gemfile.lock" }}-{{ .Branch }}
- paths:
- - ./vendor/bundle
- - run:
- name: Wait for DB
- command: dockerize -wait tcp://localhost:5432 -timeout 1m
- - run:
- name: Database setup
- command: bundle exec rails db:schema:load --trace
- - run:
- command: |
- mkdir -p /tmp/test-results/rspec
- TESTFILES=$(circleci tests glob "spec/**/*_spec.rb" | circleci tests split --split-by=timings)
- bundle exec rspec $TESTFILES --profile 10 --format RspecJunitFormatter --out /tmp/test-results/rspec/results.xml --format progress
- - store_test_results:
- path: /tmp/test-results/rspec
- - store_artifacts:
- destination: test-results
- path: /tmp/test-results/rspec
-workflows:
- version: 2
- build_and_test:
- jobs:
- - build
- - test:
- requires:
- - build
-
-# Original config.yml file:
-# version: 2.1 # Use 2.1 to enable using orbs and other features.
-#
-# # Declare the orbs that we'll use in our config.
-# # read more about orbs: https://circleci.com/docs/2.0/using-orbs/
-# orbs:
-# ruby: circleci/ruby@1.0
-#
-# jobs:
-# build: # our first job, named \"build\"
-# docker:
-# - image: cimg/ruby:2.6-node # use a tailored CircleCI docker image.
-# steps:
-# - checkout # pull down our git code.
-# - ruby/install-deps # use the ruby orb to install dependencies
-#
-# test: # our next job, called \"test\"
-# # we run \"parallel job containers\" to enable speeding up our tests;
-# # this splits our tests across multiple containers.
-# parallelism: 3
-# # here we set TWO docker images.
-# docker:
-# - image: cimg/ruby:2.6-node # this is our primary docker image, where step commands run.
-# - image: circleci/postgres:9.6.2-alpine
-# environment: # add POSTGRES environment variables.
-# POSTGRES_USER: postgres
-# POSTGRES_DB: kitbixo_test
-# POSTGRES_PASSWORD: \"postgres\"
-# # environment variables specific to Ruby/Rails, applied to the primary container.
-# environment:
-# BUNDLE_JOBS: \"3\"
-# BUNDLE_RETRY: \"3\"
-# PGHOST: 127.0.0.1
-# PGUSER: postgres
-# PGPASSWORD: \"postgres\"
-# RAILS_ENV: test
-# # A series of steps to run, some are similar to those in \"build\".
-# steps:
-# - checkout
-# - ruby/install-deps
-# # Here we make sure that the secondary container boots
-# # up before we run operations on the database.
-# - run:
-# name: Wait for DB
-# command: dockerize -wait tcp://localhost:5432 -timeout 1m
-# - run:
-# name: Database setup
-# command: bundle exec rails db:schema:load --trace
-# # Run rspec in parallel
-# - ruby/rspec-test
-#
-# # We use workflows to orchestrate the jobs that we declared above.
-# workflows:
-# version: 2
-# build_and_test: # The name of our workflow is \"build_and_test\"
-# jobs: # The list of jobs we run as part of this workflow.
-# - build # Run build first.
-# - test: # Then run test,
-# requires: # Test requires that build passes for it to run.
-# - build # Finally, run the build job.
\ No newline at end of file
diff --git a/public/404.html b/public/404.html
new file mode 100644
index 0000000..2be3af2
--- /dev/null
+++ b/public/404.html
@@ -0,0 +1,67 @@
+
+
+
+ The page you were looking for doesn't exist (404)
+
+
+
+
+
+
+
+
+
The page you were looking for doesn't exist.
+
You may have mistyped the address or the page may have moved.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/422.html b/public/422.html
new file mode 100644
index 0000000..c08eac0
--- /dev/null
+++ b/public/422.html
@@ -0,0 +1,67 @@
+
+
+
+ The change you wanted was rejected (422)
+
+
+
+
+
+
+
+
+
The change you wanted was rejected.
+
Maybe you tried to change something you didn't have access to.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/500.html b/public/500.html
new file mode 100644
index 0000000..78a030a
--- /dev/null
+++ b/public/500.html
@@ -0,0 +1,66 @@
+
+
+
+ We're sorry, but something went wrong (500)
+
+
+
+
+
+
+
+
+
We're sorry, but something went wrong.
+
+
If you are the application owner check the logs for more information.
+
+
+
diff --git a/public/apple-touch-icon-precomposed.png b/public/apple-touch-icon-precomposed.png
new file mode 100644
index 0000000..e69de29
diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png
new file mode 100644
index 0000000..e69de29
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..e69de29
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100644
index 0000000..c19f78a
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1 @@
+# See https://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
diff --git a/spec/controllers/confirmations_controller_spec.rb b/spec/controllers/confirmations_controller_spec.rb
deleted file mode 100644
index 4a1a0cf..0000000
--- a/spec/controllers/confirmations_controller_spec.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe ConfirmationsController, type: :controller do
- describe '#create' do
- before do
- request.env['HTTP_AUTHORIZATION'] = ActionController::HttpAuthentication::Basic.encode_credentials('comissao', 'bixoamigonaocomida')
- end
-
- context 'when the given bixo exists' do
- let(:bixo) { FactoryBot.create(:bixo) }
-
- it 'creates a confirmation for the given bixo' do
- expect { post :create, params: { id: bixo.id } }.to change { Confirmation.count }.by(1)
- end
- it 'sets a success flash message' do
- post :create, params: { id: bixo.id }
-
- expect(flash[:notice]).not_to be_blank
- expect(flash[:alert]).to be_blank
- end
- end
-
- context 'when the given bixo is nowhere to be found' do
- it 'creates nothing' do
- expect { post :create, params: { id: 1 } }.not_to change { Confirmation.count }
- end
-
- it 'sets a success flash message' do
- post :create, params: { id: 1 }
-
- expect(flash[:notice]).to be_blank
- expect(flash[:alert]).not_to be_blank
- end
- end
- end
-end
diff --git a/spec/factories/bixes.rb b/spec/factories/bixes.rb
new file mode 100644
index 0000000..7d50e3e
--- /dev/null
+++ b/spec/factories/bixes.rb
@@ -0,0 +1,8 @@
+FactoryBot.define do
+ factory :bixe do
+ nome { "MyString" }
+ email { "MyString" }
+ telefone { "MyString" }
+ curso { 1 }
+ end
+end
diff --git a/spec/factories/bixo_factories.rb b/spec/factories/bixo_factories.rb
deleted file mode 100644
index fb6f863..0000000
--- a/spec/factories/bixo_factories.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-FactoryBot.define do
- factory :bixo do
- nome { 'Erick Cordeiro Ozaki' }
- email { 'erick.ozaki@usp.br' }
- telefone { '11111111111' }
- curso { Bixo.cursos[:LIC] }
- tutorship { true }
- end
-end
diff --git a/spec/factories/confirmacaos.rb b/spec/factories/confirmacaos.rb
new file mode 100644
index 0000000..fe0e8b2
--- /dev/null
+++ b/spec/factories/confirmacaos.rb
@@ -0,0 +1,5 @@
+FactoryBot.define do
+ factory :confirmacao do
+ bixe { nil }
+ end
+end
diff --git a/spec/factories/confirmation_factories.rb b/spec/factories/confirmation_factories.rb
deleted file mode 100644
index 650a02b..0000000
--- a/spec/factories/confirmation_factories.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-FactoryBot.define do
- factory :confirmation do
- association :bixo, factory: :bixo
- end
-end
diff --git a/spec/factories/modalidades.rb b/spec/factories/modalidades.rb
new file mode 100644
index 0000000..c73349e
--- /dev/null
+++ b/spec/factories/modalidades.rb
@@ -0,0 +1,5 @@
+FactoryBot.define do
+ factory :modalidade do
+ name { "MyString" }
+ end
+end
diff --git a/spec/helpers/bixes_helper_spec.rb b/spec/helpers/bixes_helper_spec.rb
new file mode 100644
index 0000000..e0698c8
--- /dev/null
+++ b/spec/helpers/bixes_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the BixesHelper. For example:
+#
+# describe BixesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe BixesHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/confirmacoes_helper_spec.rb b/spec/helpers/confirmacoes_helper_spec.rb
new file mode 100644
index 0000000..7ad7015
--- /dev/null
+++ b/spec/helpers/confirmacoes_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ConfirmacoesHelper. For example:
+#
+# describe ConfirmacoesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe ConfirmacoesHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/helpers/modalidades_helper_spec.rb b/spec/helpers/modalidades_helper_spec.rb
new file mode 100644
index 0000000..8b44c1e
--- /dev/null
+++ b/spec/helpers/modalidades_helper_spec.rb
@@ -0,0 +1,15 @@
+require 'rails_helper'
+
+# Specs in this file have access to a helper object that includes
+# the ModalidadesHelper. For example:
+#
+# describe ModalidadesHelper do
+# describe "string concat" do
+# it "concats two strings with spaces" do
+# expect(helper.concat_strings("this","that")).to eq("this that")
+# end
+# end
+# end
+RSpec.describe ModalidadesHelper, type: :helper do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/bixe_spec.rb b/spec/models/bixe_spec.rb
new file mode 100644
index 0000000..afae1fb
--- /dev/null
+++ b/spec/models/bixe_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Bixe, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/bixo_spec.rb b/spec/models/bixo_spec.rb
deleted file mode 100644
index 9a5a819..0000000
--- a/spec/models/bixo_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require 'rails_helper'
-
-describe Bixo do
- it { should validate_presence_of(:nome) }
- it { should validate_presence_of(:telefone) }
- it { should validate_presence_of(:email) }
- it { should validate_presence_of(:curso) }
- it { should have_one(:confirmation) }
-
- describe '#confirmed?' do
- let(:bixo) { create(:bixo) }
- context 'when a confirmation for given bixo exists' do
- before { create(:confirmation, bixo: bixo) }
-
- it 'returns true' do
- expect(bixo.confirmed?).to be true
- end
- end
-
- context 'when a confirmation for given bixo does not exist' do
- it 'returns false' do
- expect(bixo.confirmed?).to be false
- end
- end
- end
-end
diff --git a/spec/models/confirmacao_spec.rb b/spec/models/confirmacao_spec.rb
new file mode 100644
index 0000000..9961456
--- /dev/null
+++ b/spec/models/confirmacao_spec.rb
@@ -0,0 +1,5 @@
+require 'rails_helper'
+
+RSpec.describe Confirmacao, type: :model do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
diff --git a/spec/models/confirmation_spec.rb b/spec/models/confirmation_spec.rb
deleted file mode 100644
index 4085cbf..0000000
--- a/spec/models/confirmation_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Confirmation, type: :model do
- it { should belong_to(:bixo) }
-end
diff --git a/spec/models/modalidade_spec.rb b/spec/models/modalidade_spec.rb
index 847ff23..d348b17 100644
--- a/spec/models/modalidade_spec.rb
+++ b/spec/models/modalidade_spec.rb
@@ -1,5 +1,5 @@
require 'rails_helper'
RSpec.describe Modalidade, type: :model do
- it { should validate_presence_of(:nome) }
+ pending "add some examples to (or delete) #{__FILE__}"
end
diff --git a/spec/models/pagamento_spec.rb b/spec/models/pagamento_spec.rb
deleted file mode 100644
index 4ae0b44..0000000
--- a/spec/models/pagamento_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Pagamento, type: :model do
- it { should validate_presence_of(:valor) }
-end
diff --git a/spec/models/venda_spec.rb b/spec/models/venda_spec.rb
deleted file mode 100644
index 7050c3b..0000000
--- a/spec/models/venda_spec.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Venda, type: :model do
- context `on update` do
- let(:venda) { Venda.create(bixo_id: 1) }
-
- it 'should contain errors and not save' do
- expect(venda.update(tamanho: nil, cor: 1)).to be_falsey
- expect(venda.errors).not_to be_nil
- end
-
- it 'should contain errors and not save' do
- expect(venda.update(cor: nil, tamanho: 1)).to be_falsey
- expect(venda.errors).not_to be_nil
- end
- end
-end
diff --git a/spec/models/veterano_spec.rb b/spec/models/veterano_spec.rb
deleted file mode 100644
index 8d70714..0000000
--- a/spec/models/veterano_spec.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'rails_helper'
-
-RSpec.describe Veterano, type: :model do
- it { should validate_presence_of(:nome) }
-end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
deleted file mode 100644
index 13de769..0000000
--- a/spec/rails_helper.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# This file is copied to spec/ when you run 'rails generate rspec:install'
-require 'spec_helper'
-ENV['RAILS_ENV'] ||= 'test'
-require File.expand_path('../../config/environment', __FILE__)
-# Prevent database truncation if the environment is production
-abort("The Rails environment is running in production mode!") if Rails.env.production?
-require 'rspec/rails'
-require 'shoulda-matchers'
-# Add additional requires below this line. Rails is not loaded until this point!
-
-# Requires supporting ruby files with custom matchers and macros, etc, in
-# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
-# run as spec files by default. This means that files in spec/support that end
-# in _spec.rb will both be required and run as specs, causing the specs to be
-# run twice. It is recommended that you do not name files matching this glob to
-# end with _spec.rb. You can configure this pattern with the --pattern
-# option on the command line or in ~/.rspec, .rspec or `.rspec-local`.
-#
-# The following line is provided for convenience purposes. It has the downside
-# of increasing the boot-up time by auto-requiring all files in the support
-# directory. Alternatively, in the individual `*_spec.rb` files, manually
-# require only the support files necessary.
-#
-# Dir[Rails.root.join('spec/support/**/*.rb')].each { |f| require f }
-
-# Checks for pending migration and applies them before tests are run.
-# If you are not using ActiveRecord, you can remove this line.
-ActiveRecord::Migration.maintain_test_schema!
-
-RSpec.configure do |config|
- config.include(Shoulda::Matchers::ActiveModel, type: :model)
- config.include(Shoulda::Matchers::ActiveRecord, type: :model)
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
-
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
- # examples within a transaction, remove the following line or assign false
- # instead of true.
- config.use_transactional_fixtures = true
-
- # RSpec Rails can automatically mix in different behaviours to your tests
- # based on their file location, for example enabling you to call `get` and
- # `post` in specs under `spec/controllers`.
- #
- # You can disable this behaviour by removing the line below, and instead
- # explicitly tag your specs with their type, e.g.:
- #
- # RSpec.describe UsersController, :type => :controller do
- # # ...
- # end
- #
- # The different available types are documented in the features, such as in
- # https://relishapp.com/rspec/rspec-rails/docs
- config.infer_spec_type_from_file_location!
-
- # Filter lines from Rails gems in backtraces.
- config.filter_rails_from_backtrace!
- # arbitrary gems may also be filtered via:
- # config.filter_gems_from_backtrace("gem name")
-
- # Configures RSpec to know and use FactoryBot methods
- config.include FactoryBot::Syntax::Methods
-end
diff --git a/spec/requests/bixes_spec.rb b/spec/requests/bixes_spec.rb
new file mode 100644
index 0000000..9c374ea
--- /dev/null
+++ b/spec/requests/bixes_spec.rb
@@ -0,0 +1,7 @@
+require 'rails_helper'
+
+RSpec.describe "Bixes", type: :request do
+ describe "GET /index" do
+ pending "add some examples (or delete) #{__FILE__}"
+ end
+end
diff --git a/spec/requests/confirmacoes_spec.rb b/spec/requests/confirmacoes_spec.rb
new file mode 100644
index 0000000..b376831
--- /dev/null
+++ b/spec/requests/confirmacoes_spec.rb
@@ -0,0 +1,7 @@
+require 'rails_helper'
+
+RSpec.describe "Confirmacoes", type: :request do
+ describe "GET /index" do
+ pending "add some examples (or delete) #{__FILE__}"
+ end
+end
diff --git a/spec/requests/modalidades_spec.rb b/spec/requests/modalidades_spec.rb
new file mode 100644
index 0000000..4d945c7
--- /dev/null
+++ b/spec/requests/modalidades_spec.rb
@@ -0,0 +1,7 @@
+require 'rails_helper'
+
+RSpec.describe "Modalidades", type: :request do
+ describe "GET /index" do
+ pending "add some examples (or delete) #{__FILE__}"
+ end
+end
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
deleted file mode 100644
index ce33d66..0000000
--- a/spec/spec_helper.rb
+++ /dev/null
@@ -1,96 +0,0 @@
-# This file was generated by the `rails generate rspec:install` command. Conventionally, all
-# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
-# The generated `.rspec` file contains `--require spec_helper` which will cause
-# this file to always be loaded, without a need to explicitly require it in any
-# files.
-#
-# Given that it is always loaded, you are encouraged to keep this file as
-# light-weight as possible. Requiring heavyweight dependencies from this file
-# will add to the boot time of your test suite on EVERY test run, even for an
-# individual file that may not need all of that loaded. Instead, consider making
-# a separate helper file that requires the additional dependencies and performs
-# the additional setup, and require it from the spec files that actually need
-# it.
-#
-# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
-RSpec.configure do |config|
- # rspec-expectations config goes here. You can use an alternate
- # assertion/expectation library such as wrong or the stdlib/minitest
- # assertions if you prefer.
- config.expect_with :rspec do |expectations|
- # This option will default to `true` in RSpec 4. It makes the `description`
- # and `failure_message` of custom matchers include text for helper methods
- # defined using `chain`, e.g.:
- # be_bigger_than(2).and_smaller_than(4).description
- # # => "be bigger than 2 and smaller than 4"
- # ...rather than:
- # # => "be bigger than 2"
- expectations.include_chain_clauses_in_custom_matcher_descriptions = true
- end
-
- # rspec-mocks config goes here. You can use an alternate test double
- # library (such as bogus or mocha) by changing the `mock_with` option here.
- config.mock_with :rspec do |mocks|
- # Prevents you from mocking or stubbing a method that does not exist on
- # a real object. This is generally recommended, and will default to
- # `true` in RSpec 4.
- mocks.verify_partial_doubles = true
- end
-
- # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
- # have no way to turn it off -- the option exists only for backwards
- # compatibility in RSpec 3). It causes shared context metadata to be
- # inherited by the metadata hash of host groups and examples, rather than
- # triggering implicit auto-inclusion in groups with matching metadata.
- config.shared_context_metadata_behavior = :apply_to_host_groups
-
-# The settings below are suggested to provide a good initial experience
-# with RSpec, but feel free to customize to your heart's content.
-=begin
- # This allows you to limit a spec run to individual examples or groups
- # you care about by tagging them with `:focus` metadata. When nothing
- # is tagged with `:focus`, all examples get run. RSpec also provides
- # aliases for `it`, `describe`, and `context` that include `:focus`
- # metadata: `fit`, `fdescribe` and `fcontext`, respectively.
- config.filter_run_when_matching :focus
-
- # Allows RSpec to persist some state between runs in order to support
- # the `--only-failures` and `--next-failure` CLI options. We recommend
- # you configure your source control system to ignore this file.
- config.example_status_persistence_file_path = "spec/examples.txt"
-
- # Limits the available syntax to the non-monkey patched syntax that is
- # recommended. For more details, see:
- # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
- # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
- # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
- config.disable_monkey_patching!
-
- # Many RSpec users commonly either run the entire suite or an individual
- # file, and it's useful to allow more verbose output when running an
- # individual spec file.
- if config.files_to_run.one?
- # Use the documentation formatter for detailed output,
- # unless a formatter has already been configured
- # (e.g. via a command-line flag).
- config.default_formatter = "doc"
- end
-
- # Print the 10 slowest examples and example groups at the
- # end of the spec run, to help surface which specs are running
- # particularly slow.
- config.profile_examples = 10
-
- # Run specs in random order to surface order dependencies. If you find an
- # order dependency and want to debug it, you can fix the order by providing
- # the seed, which is printed after each run.
- # --seed 1234
- config.order = :random
-
- # Seed global randomization in this process using the `--seed` CLI option.
- # Setting this allows you to use `--seed` to deterministically reproduce
- # test failures related to randomization by passing the same `--seed` value
- # as the one that triggered the failure.
- Kernel.srand config.seed
-=end
-end
diff --git a/storage/.keep b/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb
new file mode 100644
index 0000000..d19212a
--- /dev/null
+++ b/test/application_system_test_case.rb
@@ -0,0 +1,5 @@
+require "test_helper"
+
+class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
+ driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
+end
diff --git a/test/channels/application_cable/connection_test.rb b/test/channels/application_cable/connection_test.rb
new file mode 100644
index 0000000..800405f
--- /dev/null
+++ b/test/channels/application_cable/connection_test.rb
@@ -0,0 +1,11 @@
+require "test_helper"
+
+class ApplicationCable::ConnectionTest < ActionCable::Connection::TestCase
+ # test "connects with cookies" do
+ # cookies.signed[:user_id] = 42
+ #
+ # connect
+ #
+ # assert_equal connection.user_id, "42"
+ # end
+end
diff --git a/test/controllers/.keep b/test/controllers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/fixtures/files/.keep b/test/fixtures/files/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/helpers/.keep b/test/helpers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/integration/.keep b/test/integration/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/mailers/.keep b/test/mailers/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/models/.keep b/test/models/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/system/.keep b/test/system/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/test/test_helper.rb b/test/test_helper.rb
new file mode 100644
index 0000000..d713e37
--- /dev/null
+++ b/test/test_helper.rb
@@ -0,0 +1,13 @@
+ENV["RAILS_ENV"] ||= "test"
+require_relative "../config/environment"
+require "rails/test_help"
+
+class ActiveSupport::TestCase
+ # Run tests in parallel with specified workers
+ parallelize(workers: :number_of_processors)
+
+ # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
+ fixtures :all
+
+ # Add more helper methods to be used by all tests here...
+end
diff --git a/tmp/.keep b/tmp/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/tmp/pids/.keep b/tmp/pids/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/tmp/storage/.keep b/tmp/storage/.keep
new file mode 100644
index 0000000..e69de29
diff --git a/vendor/.keep b/vendor/.keep
new file mode 100644
index 0000000..e69de29