fine_print 3.1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +6 -6
  3. data/app/controllers/fine_print/application_controller.rb +1 -1
  4. data/app/controllers/fine_print/contracts_controller.rb +1 -1
  5. data/app/controllers/fine_print/signatures_controller.rb +5 -5
  6. data/app/models/fine_print/contract.rb +5 -4
  7. data/app/views/fine_print/signatures/_form.html.erb +2 -1
  8. data/config/initializers/fine_print.rb +14 -19
  9. data/db/migrate/0_install_fine_print.rb +1 -1
  10. data/db/migrate/1_add_implicit_signatures.rb +1 -1
  11. data/lib/fine_print/action_controller/base.rb +5 -5
  12. data/lib/fine_print/engine.rb +5 -5
  13. data/lib/fine_print/version.rb +1 -1
  14. data/lib/fine_print.rb +24 -13
  15. data/spec/controllers/contracts_controller_spec.rb +22 -22
  16. data/spec/controllers/signatures_controller_spec.rb +11 -11
  17. data/spec/dummy/Rakefile +2 -2
  18. data/spec/dummy/app/assets/config/manifest.js +4 -0
  19. data/spec/dummy/app/assets/javascripts/application.js +5 -3
  20. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  21. data/spec/dummy/app/assets/stylesheets/application.css +6 -4
  22. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  23. data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
  24. data/spec/dummy/app/controllers/dummy_models_controller.rb +1 -1
  25. data/spec/dummy/app/jobs/application_job.rb +2 -0
  26. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  27. data/spec/dummy/app/models/application_record.rb +3 -0
  28. data/spec/dummy/app/models/dummy_user.rb +1 -1
  29. data/spec/dummy/app/views/layouts/application.html.erb +10 -10
  30. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  31. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  32. data/spec/dummy/bin/bundle +1 -1
  33. data/spec/dummy/bin/rails +1 -1
  34. data/spec/dummy/bin/setup +36 -0
  35. data/spec/dummy/bin/update +31 -0
  36. data/spec/dummy/bin/yarn +11 -0
  37. data/spec/dummy/config/application.rb +7 -13
  38. data/spec/dummy/config/boot.rb +3 -3
  39. data/spec/dummy/config/cable.yml +10 -0
  40. data/spec/dummy/config/database.yml +9 -9
  41. data/spec/dummy/config/environment.rb +2 -2
  42. data/spec/dummy/config/environments/development.rb +37 -5
  43. data/spec/dummy/config/environments/production.rb +43 -29
  44. data/spec/dummy/config/environments/test.rb +14 -4
  45. data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
  46. data/spec/dummy/config/initializers/assets.rb +14 -0
  47. data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
  48. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  49. data/spec/dummy/config/initializers/fine_print.rb +1 -2
  50. data/spec/dummy/config/initializers/mime_types.rb +0 -1
  51. data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
  52. data/spec/dummy/config/locales/en.yml +10 -0
  53. data/spec/dummy/config/puma.rb +34 -0
  54. data/spec/dummy/config/spring.rb +6 -0
  55. data/spec/dummy/config/storage.yml +34 -0
  56. data/spec/dummy/config.ru +2 -1
  57. data/spec/dummy/db/migrate/1000_create_dummy_users.rb +1 -1
  58. data/spec/dummy/db/schema.rb +15 -18
  59. data/spec/dummy/db/test.sqlite3 +0 -0
  60. data/spec/dummy/log/test.log +790 -3835
  61. data/spec/dummy/package.json +5 -0
  62. data/spec/dummy/public/404.html +24 -15
  63. data/spec/dummy/public/422.html +24 -15
  64. data/spec/dummy/public/500.html +23 -14
  65. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  66. data/spec/dummy/public/apple-touch-icon.png +0 -0
  67. data/spec/factories/fine_print/contract.rb +2 -2
  68. data/spec/factories/fine_print/signature.rb +2 -2
  69. data/spec/factories/user.rb +1 -1
  70. data/spec/lib/fine_print_spec.rb +4 -4
  71. data/spec/models/contract_spec.rb +6 -6
  72. data/spec/models/signature_spec.rb +2 -2
  73. data/spec/spec_helper.rb +3 -1
  74. data/spec/support/controller.rb +2 -2
  75. metadata +97 -43
  76. data/spec/dummy/README.md +0 -3
  77. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  78. data/spec/dummy/config/initializers/session_store.rb +0 -3
@@ -8,59 +8,59 @@ module FinePrint
8
8
  setup_controller_spec
9
9
  end
10
10
 
11
- let!(:signature) { FactoryGirl.create(:fine_print_signature) }
11
+ let!(:signature) { FactoryBot.create(:fine_print_signature) }
12
12
 
13
13
  it "won't get index unless authorized" do
14
- get :index, contract_id: signature.contract.id
14
+ get :index, params: { contract_id: signature.contract.id }
15
15
  expect(response.status).to eq 403
16
16
 
17
17
  sign_in @user
18
- get :index, contract_id: signature.contract.id
18
+ get :index, params: { contract_id: signature.contract.id }
19
19
  expect(response.status).to eq 403
20
20
  end
21
21
 
22
22
  it 'must get index if authorized' do
23
23
  sign_in @admin
24
- get :index, contract_id: signature.contract.id
24
+ get :index, params: { contract_id: signature.contract.id }
25
25
  expect(response.status).to eq 200
26
26
  end
27
27
 
28
28
  it "won't get new unless signed in" do
29
- get :new, contract_id: signature.contract.id
29
+ get :new, params: { contract_id: signature.contract.id }
30
30
  expect(response.status).to eq 401
31
31
  end
32
32
 
33
33
  it 'must get new if signed in' do
34
34
  sign_in @user
35
- get :new, contract_id: signature.contract.id
35
+ get :new, params: { contract_id: signature.contract.id }
36
36
  expect(response.status).to eq 200
37
37
  end
38
38
 
39
39
  it "won't create unless signed in" do
40
- post :create, contract_id: signature.contract.id
40
+ post :create, params: { contract_id: signature.contract.id }
41
41
  expect(response.status).to eq 401
42
42
  end
43
43
 
44
44
  it 'must create if signed in' do
45
45
  sign_in @user
46
- get :new, contract_id: signature.contract.id
46
+ get :new, params: { contract_id: signature.contract.id }
47
47
  expect(response.status).to eq 200
48
48
  end
49
49
 
50
50
  it "won't destroy unless authorized" do
51
- delete :destroy, id: signature.id
51
+ delete :destroy, params: { id: signature.id }
52
52
  expect(response.status).to eq 403
53
53
  expect(Signature.find(signature.id)).to eq signature
54
54
 
55
55
  sign_in @user
56
- delete :destroy, id: signature.id
56
+ delete :destroy, params: { id: signature.id }
57
57
  expect(response.status).to eq 403
58
58
  expect(Signature.find(signature.id)).to eq signature
59
59
  end
60
60
 
61
61
  it 'must destroy if authorized' do
62
62
  sign_in @admin
63
- delete :destroy, id: signature.id
63
+ delete :destroy, params: { id: signature.id }
64
64
  expect(response).to redirect_to contract_signatures_path(signature.contract)
65
65
  expect(Signature.find_by_id(signature.id)).to be_nil
66
66
  end
data/spec/dummy/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  # Add your own tasks in files placed in lib/tasks ending in .rake,
2
2
  # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
3
 
4
- require File.expand_path('../config/application', __FILE__)
4
+ require_relative 'config/application'
5
5
 
6
- Dummy::Application.load_tasks
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../javascripts .js
3
+ //= link_directory ../stylesheets .css
4
+ //= link fine_print_manifest.js
@@ -2,12 +2,14 @@
2
2
  // listed below.
3
3
  //
4
4
  // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
- // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
6
  //
7
7
  // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
- // compiled file.
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
9
  //
10
- // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
11
  // about supported directives.
12
12
  //
13
+ //= require rails-ujs
14
+ //= require activestorage
13
15
  //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the `rails generate channel` command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
@@ -3,11 +3,13 @@
3
3
  * listed below.
4
4
  *
5
5
  * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
- * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
7
  *
8
- * You're free to add application-wide styles to this file and they'll appear at the top of the
9
- * compiled file, but it's generally better to create a new file per style scope.
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/SCSS
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.
10
12
  *
11
- *= require_self
12
13
  *= require_tree .
14
+ *= require_self
13
15
  */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -1,2 +1,2 @@
1
- class DummyModelsController < ActionController::Base
1
+ class DummyModelsController < ApplicationController
2
2
  end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
@@ -1,2 +1,2 @@
1
- class DummyUser < ActiveRecord::Base
1
+ class DummyUser < ApplicationRecord
2
2
  end
@@ -1,15 +1,15 @@
1
1
  <!DOCTYPE html>
2
2
  <html>
3
- <head>
4
- <title>Dummy</title>
5
- <%= stylesheet_link_tag "application", media: "all",
6
- "data-turbolinks-track" => true %>
7
- <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
8
- <%= csrf_meta_tags %>
9
- </head>
10
- <body>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
11
7
 
12
- <%= yield %>
8
+ <%= stylesheet_link_tag 'application', media: 'all' %>
9
+ <%= javascript_include_tag 'application' %>
10
+ </head>
13
11
 
14
- </body>
12
+ <body>
13
+ <%= yield %>
14
+ </body>
15
15
  </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
3
3
  load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
3
  require_relative '../config/boot'
4
4
  require 'rails/commands'
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a starting point to setup your application.
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
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ # puts "\n== Copying sample files =="
24
+ # unless File.exist?('config/database.yml')
25
+ # cp 'config/database.yml.sample', 'config/database.yml'
26
+ # end
27
+
28
+ puts "\n== Preparing database =="
29
+ system! 'bin/rails db:setup'
30
+
31
+ puts "\n== Removing old logs and tempfiles =="
32
+ system! 'bin/rails log:clear tmp:clear'
33
+
34
+ puts "\n== Restarting application server =="
35
+ system! 'bin/rails restart'
36
+ end
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby
2
+ require 'fileutils'
3
+ include FileUtils
4
+
5
+ # path to your application root.
6
+ APP_ROOT = File.expand_path('..', __dir__)
7
+
8
+ def system!(*args)
9
+ system(*args) || abort("\n== Command #{args} failed ==")
10
+ end
11
+
12
+ chdir APP_ROOT do
13
+ # This script is a way to update your development environment automatically.
14
+ # Add necessary update steps to this file.
15
+
16
+ puts '== Installing dependencies =='
17
+ system! 'gem install bundler --conservative'
18
+ system('bundle check') || system!('bundle install')
19
+
20
+ # Install JavaScript dependencies if using Yarn
21
+ # system('bin/yarn')
22
+
23
+ puts "\n== Updating database =="
24
+ system! 'bin/rails db:migrate'
25
+
26
+ puts "\n== Removing old logs and tempfiles =="
27
+ system! 'bin/rails log:clear tmp:clear'
28
+
29
+ puts "\n== Restarting application server =="
30
+ system! 'bin/rails restart'
31
+ end
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path('..', __dir__)
3
+ Dir.chdir(APP_ROOT) do
4
+ begin
5
+ exec "yarnpkg", *ARGV
6
+ rescue Errno::ENOENT
7
+ $stderr.puts "Yarn executable was not detected in the system."
8
+ $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9
+ exit 1
10
+ end
11
+ end
@@ -1,4 +1,4 @@
1
- require File.expand_path('../boot', __FILE__)
1
+ require_relative 'boot'
2
2
 
3
3
  require 'rails/all'
4
4
 
@@ -7,19 +7,13 @@ require "fine_print"
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
- # config.time_zone = 'Central Time (US & Canada)'
10
+ # Initialize configuration defaults for originally generated Rails version.
11
+ config.load_defaults 5.2
17
12
 
18
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
- # config.i18n.default_locale = :de
21
-
22
- config.i18n.enforce_available_locales = true
13
+ # Settings in config/environments/* take precedence over those specified here.
14
+ # Application configuration can go into files in config/initializers
15
+ # -- all .rb files in that directory are automatically loaded after loading
16
+ # the framework and any gems in your application.
23
17
  end
24
18
  end
25
19
 
@@ -1,5 +1,5 @@
1
1
  # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
3
 
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,10 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
10
+ channel_prefix: dummy_production
@@ -3,23 +3,23 @@
3
3
  #
4
4
  # Ensure the SQLite 3 gem is defined in your Gemfile
5
5
  # gem 'sqlite3'
6
- development:
6
+ #
7
+ default: &default
7
8
  adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
9
+ pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
10
10
  timeout: 5000
11
11
 
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
12
16
  # Warning: The database defined as "test" will be erased and
13
17
  # re-generated from your development database when you run "rake".
14
18
  # Do not set this db to the same as development or production.
15
19
  test:
16
- adapter: sqlite3
20
+ <<: *default
17
21
  database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
22
 
21
23
  production:
22
- adapter: sqlite3
24
+ <<: *default
23
25
  database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +1,5 @@
1
1
  # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
2
+ require_relative 'application'
3
3
 
4
4
  # Initialize the Rails application.
5
- Dummy::Application.initialize!
5
+ Rails.application.initialize!
@@ -1,4 +1,4 @@
1
- Dummy::Application.configure do
1
+ Rails.application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb.
3
3
 
4
4
  # In the development environment your application's code is reloaded on
@@ -9,21 +9,53 @@ Dummy::Application.configure do
9
9
  # Do not eager load code on boot.
10
10
  config.eager_load = false
11
11
 
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
12
+ # Show full error reports.
13
+ config.consider_all_requests_local = true
14
+
15
+ # Enable/disable caching. By default caching is disabled.
16
+ # Run rails dev:cache to toggle caching.
17
+ if Rails.root.join('tmp', 'caching-dev.txt').exist?
18
+ config.action_controller.perform_caching = true
19
+
20
+ config.cache_store = :memory_store
21
+ config.public_file_server.headers = {
22
+ 'Cache-Control' => "public, max-age=#{2.days.to_i}"
23
+ }
24
+ else
25
+ config.action_controller.perform_caching = false
26
+
27
+ config.cache_store = :null_store
28
+ end
29
+
30
+ # Store uploaded files on the local file system (see config/storage.yml for options)
31
+ config.active_storage.service = :local
15
32
 
16
33
  # Don't care if the mailer can't send.
17
34
  config.action_mailer.raise_delivery_errors = false
18
35
 
36
+ config.action_mailer.perform_caching = false
37
+
19
38
  # Print deprecation notices to the Rails logger.
20
39
  config.active_support.deprecation = :log
21
40
 
22
- # Raise an error on page load if there are pending migrations
41
+ # Raise an error on page load if there are pending migrations.
23
42
  config.active_record.migration_error = :page_load
24
43
 
44
+ # Highlight code that triggered database queries in logs.
45
+ config.active_record.verbose_query_logs = true
46
+
25
47
  # Debug mode disables concatenation and preprocessing of assets.
26
48
  # This option may cause significant delays in view rendering with a large
27
49
  # number of complex assets.
28
50
  config.assets.debug = true
51
+
52
+ # Suppress logger output for asset requests.
53
+ config.assets.quiet = true
54
+
55
+ # Raises error for missing translations
56
+ # config.action_view.raise_on_missing_translations = true
57
+
58
+ # Use an evented file watcher to asynchronously detect changes in source code,
59
+ # routes, locales, etc. This feature depends on the listen gem.
60
+ # config.file_watcher = ActiveSupport::EventedFileUpdateChecker
29
61
  end