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.
- checksums.yaml +5 -5
- data/README.md +6 -6
- data/app/controllers/fine_print/application_controller.rb +1 -1
- data/app/controllers/fine_print/contracts_controller.rb +1 -1
- data/app/controllers/fine_print/signatures_controller.rb +5 -5
- data/app/models/fine_print/contract.rb +5 -4
- data/app/views/fine_print/signatures/_form.html.erb +2 -1
- data/config/initializers/fine_print.rb +14 -19
- data/db/migrate/0_install_fine_print.rb +1 -1
- data/db/migrate/1_add_implicit_signatures.rb +1 -1
- data/lib/fine_print/action_controller/base.rb +5 -5
- data/lib/fine_print/engine.rb +5 -5
- data/lib/fine_print/version.rb +1 -1
- data/lib/fine_print.rb +24 -13
- data/spec/controllers/contracts_controller_spec.rb +22 -22
- data/spec/controllers/signatures_controller_spec.rb +11 -11
- data/spec/dummy/Rakefile +2 -2
- data/spec/dummy/app/assets/config/manifest.js +4 -0
- data/spec/dummy/app/assets/javascripts/application.js +5 -3
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +6 -4
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/dummy_models_controller.rb +1 -1
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/models/dummy_user.rb +1 -1
- data/spec/dummy/app/views/layouts/application.html.erb +10 -10
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +1 -1
- data/spec/dummy/bin/rails +1 -1
- data/spec/dummy/bin/setup +36 -0
- data/spec/dummy/bin/update +31 -0
- data/spec/dummy/bin/yarn +11 -0
- data/spec/dummy/config/application.rb +7 -13
- data/spec/dummy/config/boot.rb +3 -3
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/database.yml +9 -9
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/development.rb +37 -5
- data/spec/dummy/config/environments/production.rb +43 -29
- data/spec/dummy/config/environments/test.rb +14 -4
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +14 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/fine_print.rb +1 -2
- data/spec/dummy/config/initializers/mime_types.rb +0 -1
- data/spec/dummy/config/initializers/wrap_parameters.rb +2 -2
- data/spec/dummy/config/locales/en.yml +10 -0
- data/spec/dummy/config/puma.rb +34 -0
- data/spec/dummy/config/spring.rb +6 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/config.ru +2 -1
- data/spec/dummy/db/migrate/1000_create_dummy_users.rb +1 -1
- data/spec/dummy/db/schema.rb +15 -18
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/test.log +790 -3835
- data/spec/dummy/package.json +5 -0
- data/spec/dummy/public/404.html +24 -15
- data/spec/dummy/public/422.html +24 -15
- data/spec/dummy/public/500.html +23 -14
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/factories/fine_print/contract.rb +2 -2
- data/spec/factories/fine_print/signature.rb +2 -2
- data/spec/factories/user.rb +1 -1
- data/spec/lib/fine_print_spec.rb +4 -4
- data/spec/models/contract_spec.rb +6 -6
- data/spec/models/signature_spec.rb +2 -2
- data/spec/spec_helper.rb +3 -1
- data/spec/support/controller.rb +2 -2
- metadata +97 -43
- data/spec/dummy/README.md +0 -3
- data/spec/dummy/config/initializers/secret_token.rb +0 -12
- 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) {
|
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
|
-
|
4
|
+
require_relative 'config/application'
|
5
5
|
|
6
|
-
|
6
|
+
Rails.application.load_tasks
|
@@ -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
|
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/
|
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
|
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
|
9
|
-
* compiled file
|
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
|
*/
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class DummyModelsController <
|
1
|
+
class DummyModelsController < ApplicationController
|
2
2
|
end
|
@@ -1,2 +1,2 @@
|
|
1
|
-
class DummyUser <
|
1
|
+
class DummyUser < ApplicationRecord
|
2
2
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
<head>
|
4
|
-
|
5
|
-
|
6
|
-
|
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
|
-
<%=
|
8
|
+
<%= stylesheet_link_tag 'application', media: 'all' %>
|
9
|
+
<%= javascript_include_tag 'application' %>
|
10
|
+
</head>
|
13
11
|
|
14
|
-
|
12
|
+
<body>
|
13
|
+
<%= yield %>
|
14
|
+
</body>
|
15
15
|
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= yield %>
|
data/spec/dummy/bin/bundle
CHANGED
data/spec/dummy/bin/rails
CHANGED
@@ -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
|
data/spec/dummy/bin/yarn
ADDED
@@ -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
|
-
|
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
|
-
#
|
11
|
-
|
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
|
-
#
|
19
|
-
#
|
20
|
-
#
|
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
|
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Set up gems listed in the Gemfile.
|
2
|
-
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('
|
2
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
|
3
3
|
|
4
|
-
require 'bundler/setup' if File.
|
5
|
-
$LOAD_PATH.unshift File.expand_path('
|
4
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
5
|
+
$LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
|
@@ -3,23 +3,23 @@
|
|
3
3
|
#
|
4
4
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
5
|
# gem 'sqlite3'
|
6
|
-
|
6
|
+
#
|
7
|
+
default: &default
|
7
8
|
adapter: sqlite3
|
8
|
-
|
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
|
-
|
20
|
+
<<: *default
|
17
21
|
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
22
|
|
21
23
|
production:
|
22
|
-
|
24
|
+
<<: *default
|
23
25
|
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
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
|
13
|
-
config.consider_all_requests_local
|
14
|
-
|
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
|