bard-file_field 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +7 -0
  2. data/.nvmrc +1 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/Gemfile +8 -0
  6. data/Gemfile.lock +98 -0
  7. data/LICENSE +21 -0
  8. data/README.md +29 -0
  9. data/Rakefile +4 -0
  10. data/app/assets/javascripts/bard-file.js +4913 -0
  11. data/app/controllers/bard/file_field/blobs_controller.rb +11 -0
  12. data/bard-file/.gitignore +1 -0
  13. data/bard-file/bun.lockb +0 -0
  14. data/bard-file/index.js +2 -0
  15. data/bard-file/package.json +20 -0
  16. data/bard-file/rollup.config.js +26 -0
  17. data/bard-file_field.gemspec +34 -0
  18. data/config/routes.rb +6 -0
  19. data/dummy/.gitattributes +7 -0
  20. data/dummy/.gitignore +36 -0
  21. data/dummy/Gemfile +29 -0
  22. data/dummy/Gemfile.lock +353 -0
  23. data/dummy/README.md +24 -0
  24. data/dummy/Rakefile +13 -0
  25. data/dummy/app/assets/config/manifest.js +3 -0
  26. data/dummy/app/assets/images/.keep +0 -0
  27. data/dummy/app/assets/stylesheets/application.css +22 -0
  28. data/dummy/app/controllers/application_controller.rb +2 -0
  29. data/dummy/app/controllers/concerns/.keep +0 -0
  30. data/dummy/app/controllers/edge_cases_controller.rb +23 -0
  31. data/dummy/app/controllers/posts_controller.rb +33 -0
  32. data/dummy/app/controllers/validations_controller.rb +18 -0
  33. data/dummy/app/helpers/application_helper.rb +2 -0
  34. data/dummy/app/javascript/application.js +2 -0
  35. data/dummy/app/javascript/controllers/application.js +9 -0
  36. data/dummy/app/javascript/controllers/index.js +11 -0
  37. data/dummy/app/models/application_record.rb +3 -0
  38. data/dummy/app/models/concerns/.keep +0 -0
  39. data/dummy/app/models/post.rb +9 -0
  40. data/dummy/app/views/edge_cases/rails_validation_error.html.erb +16 -0
  41. data/dummy/app/views/layouts/application.html.erb +18 -0
  42. data/dummy/app/views/layouts/mailer.html.erb +13 -0
  43. data/dummy/app/views/layouts/mailer.text.erb +1 -0
  44. data/dummy/app/views/posts/form.html.erb +39 -0
  45. data/dummy/app/views/posts/show.html.erb +16 -0
  46. data/dummy/app/views/validations/form.html.erb +19 -0
  47. data/dummy/app/views/validations/optional_file.html.erb +10 -0
  48. data/dummy/app/views/validations/optional_file_with_max_size.html.erb +10 -0
  49. data/dummy/app/views/validations/optional_image.html.erb +10 -0
  50. data/dummy/app/views/validations/required_file.html.erb +10 -0
  51. data/dummy/app/views/validations/required_media.html.erb +10 -0
  52. data/dummy/bin/bundle +114 -0
  53. data/dummy/bin/importmap +4 -0
  54. data/dummy/bin/rails +4 -0
  55. data/dummy/bin/rake +4 -0
  56. data/dummy/bin/setup +33 -0
  57. data/dummy/config/application.rb +22 -0
  58. data/dummy/config/boot.rb +4 -0
  59. data/dummy/config/cable.yml +10 -0
  60. data/dummy/config/credentials.yml.enc +1 -0
  61. data/dummy/config/cucumber.yml +2 -0
  62. data/dummy/config/database.yml +25 -0
  63. data/dummy/config/environment.rb +5 -0
  64. data/dummy/config/environments/development.rb +70 -0
  65. data/dummy/config/environments/production.rb +93 -0
  66. data/dummy/config/environments/test.rb +60 -0
  67. data/dummy/config/importmap.rb +4 -0
  68. data/dummy/config/initializers/assets.rb +12 -0
  69. data/dummy/config/initializers/content_security_policy.rb +25 -0
  70. data/dummy/config/initializers/filter_parameter_logging.rb +8 -0
  71. data/dummy/config/initializers/inflections.rb +16 -0
  72. data/dummy/config/initializers/permissions_policy.rb +11 -0
  73. data/dummy/config/locales/en.yml +33 -0
  74. data/dummy/config/puma.rb +43 -0
  75. data/dummy/config/routes.rb +7 -0
  76. data/dummy/config/storage.yml +34 -0
  77. data/dummy/config.ru +6 -0
  78. data/dummy/db/migrate/20231013175203_create_posts.rb +8 -0
  79. data/dummy/db/migrate/20231013175257_create_active_storage_tables.active_storage.rb +57 -0
  80. data/dummy/db/migrate/20231102131420_add_name_to_posts.rb +5 -0
  81. data/dummy/db/schema.rb +50 -0
  82. data/dummy/db/seeds.rb +7 -0
  83. data/dummy/features/edge_cases.feature +17 -0
  84. data/dummy/features/form-persistence.feature +40 -0
  85. data/dummy/features/form_bard_file_field_helper.feature +98 -0
  86. data/dummy/features/support/env.rb +21 -0
  87. data/dummy/features/support/fixtures/empty.3gpp +0 -0
  88. data/dummy/features/support/fixtures/empty.JPEG +0 -0
  89. data/dummy/features/support/fixtures/empty.M4V +0 -0
  90. data/dummy/features/support/fixtures/empty.avi +0 -0
  91. data/dummy/features/support/fixtures/empty.bmp +0 -0
  92. data/dummy/features/support/fixtures/empty.flv +0 -0
  93. data/dummy/features/support/fixtures/empty.gif +0 -0
  94. data/dummy/features/support/fixtures/empty.heic +0 -0
  95. data/dummy/features/support/fixtures/empty.jpeg +0 -0
  96. data/dummy/features/support/fixtures/empty.jpg +0 -0
  97. data/dummy/features/support/fixtures/empty.m4v +0 -0
  98. data/dummy/features/support/fixtures/empty.mkv +0 -0
  99. data/dummy/features/support/fixtures/empty.mov +0 -0
  100. data/dummy/features/support/fixtures/empty.mp4 +0 -0
  101. data/dummy/features/support/fixtures/empty.png +0 -0
  102. data/dummy/features/support/fixtures/empty.tiff +0 -0
  103. data/dummy/features/support/fixtures/empty.webm +0 -0
  104. data/dummy/features/support/fixtures/empty.wmv +0 -0
  105. data/dummy/features/support/fixtures/image.jpg +0 -0
  106. data/dummy/features/support/fixtures/image2.jpg +0 -0
  107. data/dummy/features/support/fixtures/video.mp4 +0 -0
  108. data/dummy/features/support/selectors.rb +63 -0
  109. data/dummy/features/support/step_definitions/download_steps.rb +4 -0
  110. data/dummy/features/support/step_definitions/web_steps.rb +94 -0
  111. data/dummy/features/validations.feature +71 -0
  112. data/dummy/lib/assets/.keep +0 -0
  113. data/dummy/lib/tasks/.keep +0 -0
  114. data/dummy/log/.keep +0 -0
  115. data/dummy/public/404.html +67 -0
  116. data/dummy/public/422.html +67 -0
  117. data/dummy/public/500.html +66 -0
  118. data/dummy/public/apple-touch-icon-precomposed.png +0 -0
  119. data/dummy/public/apple-touch-icon.png +0 -0
  120. data/dummy/public/favicon.ico +0 -0
  121. data/dummy/public/robots.txt +1 -0
  122. data/dummy/storage/.keep +0 -0
  123. data/dummy/test/application_system_test_case.rb +21 -0
  124. data/dummy/test/channels/application_cable/connection_test.rb +11 -0
  125. data/dummy/test/controllers/.keep +0 -0
  126. data/dummy/test/fixtures/files/.keep +0 -0
  127. data/dummy/test/helpers/.keep +0 -0
  128. data/dummy/test/integration/.keep +0 -0
  129. data/dummy/test/mailers/.keep +0 -0
  130. data/dummy/test/models/.keep +0 -0
  131. data/dummy/test/system/.keep +0 -0
  132. data/dummy/test/system/tests_test.rb +9 -0
  133. data/dummy/test/test_helper.rb +13 -0
  134. data/dummy/tmp/.keep +0 -0
  135. data/dummy/tmp/pids/.keep +0 -0
  136. data/dummy/tmp/storage/.keep +0 -0
  137. data/lib/bard/file_field/field.rb +27 -0
  138. data/lib/bard/file_field/form_builder.rb +12 -0
  139. data/lib/bard/file_field/version.rb +7 -0
  140. data/lib/bard/file_field.rb +20 -0
  141. metadata +197 -0
@@ -0,0 +1,11 @@
1
+ module Bard
2
+ module FileField
3
+ class BlobsController < ActionController::Base
4
+ def show
5
+ @blob = ActiveStorage::Blob.find_signed!(params[:signed_id])
6
+ render json: @blob
7
+ end
8
+ end
9
+ end
10
+ end
11
+
@@ -0,0 +1 @@
1
+ node_modules
Binary file
@@ -0,0 +1,2 @@
1
+ import { defineCustomElements } from "bard-file"
2
+ defineCustomElements()
@@ -0,0 +1,20 @@
1
+ {
2
+ "type": "module",
3
+ "scripts": {
4
+ "clean": "rm -f app/assets/javascripts/bard-file.js",
5
+ "build": "rollup -c"
6
+ },
7
+ "devDependencies": {
8
+ "@rails/activestorage": "^7.1.2",
9
+ "@rollup/plugin-commonjs": "^25.0.7",
10
+ "@rollup/plugin-node-resolve": "^15.2.3",
11
+ "rollup": "^4.5.2",
12
+ "rollup-plugin-includepaths": "^0.2.4"
13
+ },
14
+ "dependencies": {
15
+ "@stencil/core": "^4.8.0",
16
+ "mime-lite": "^1.0.3",
17
+ "rails-request-json": "^0.1.3",
18
+ "bard-file": "file:../../bard-file"
19
+ }
20
+ }
@@ -0,0 +1,26 @@
1
+ import resolve from "@rollup/plugin-node-resolve"
2
+ import includePaths from 'rollup-plugin-includepaths';
3
+ import commonjs from '@rollup/plugin-commonjs';
4
+
5
+ export default [
6
+ {
7
+ input: "./index.js",
8
+ output: [
9
+ {
10
+ file: "../app/assets/javascripts/bard-file.js",
11
+ format: "es",
12
+ },
13
+ ],
14
+ context: "window",
15
+ external: [
16
+ "@rails/activestorage",
17
+ ],
18
+ plugins: [
19
+ resolve(),
20
+ includePaths({
21
+ paths: "src",
22
+ }),
23
+ commonjs(),
24
+ ]
25
+ },
26
+ ]
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/bard/file_field/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "bard-file_field"
7
+ spec.version = Bard::FileField::VERSION
8
+ spec.authors = ["Micah Geisel"]
9
+ spec.email = ["micah@botandrose.com"]
10
+
11
+ spec.summary = "Enhanced file field"
12
+ spec.description = "Enhanced file field"
13
+ spec.homepage = "https://github.com/botandrose/bard-file_field"
14
+ spec.required_ruby_version = ">= 3.0.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["source_code_uri"] = "https://github.com/botandrose/bard-file_field"
18
+
19
+ # Specify which files should be added to the gem when it is released.
20
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
21
+ spec.files = Dir.chdir(__dir__) do
22
+ `git ls-files -z`.split("\x0").reject do |f|
23
+ (f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
24
+ end
25
+ end
26
+ spec.bindir = "exe"
27
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
28
+ spec.require_paths = ["lib"]
29
+
30
+ spec.add_dependency "activestorage", "~>7.1.0"
31
+
32
+ # For more information and examples about making a new gem, check out our
33
+ # guide at: https://bundler.io/guides/creating_gem.html
34
+ end
data/config/routes.rb ADDED
@@ -0,0 +1,6 @@
1
+ Rails.application.routes.draw do
2
+ scope ActiveStorage.routes_prefix do
3
+ get "/blobs/info/:signed_id" => "bard/file_field/blobs#show", as: :rails_service_blob_info
4
+ end
5
+ end
6
+
@@ -0,0 +1,7 @@
1
+ # See https://git-scm.com/docs/gitattributes for more about git attribute files.
2
+
3
+ # Mark the database schema as having been generated.
4
+ db/schema.rb linguist-generated
5
+
6
+ # Mark any vendored files as having been vendored.
7
+ vendor/* linguist-vendored
data/dummy/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ # See https://help.github.com/articles/ignoring-files for more about ignoring files.
2
+ #
3
+ # If you find yourself ignoring temporary files generated by your text editor
4
+ # or operating system, you probably want to add a global ignore instead:
5
+ # git config --global core.excludesfile '~/.gitignore_global'
6
+
7
+ # Ignore bundler config.
8
+ /.bundle
9
+ /.byebug_history
10
+
11
+ # Ignore the default SQLite database.
12
+ /db/*.sqlite3
13
+ /db/*.sqlite3-*
14
+
15
+ # Ignore all logfiles and tempfiles.
16
+ /log/*
17
+ /tmp/*
18
+ !/log/.keep
19
+ !/tmp/.keep
20
+
21
+ # Ignore pidfiles, but keep the directory.
22
+ /tmp/pids/*
23
+ !/tmp/pids/
24
+ !/tmp/pids/.keep
25
+
26
+ # Ignore uploaded files in development.
27
+ /storage/*
28
+ !/storage/.keep
29
+ /tmp/storage/*
30
+ !/tmp/storage/
31
+ !/tmp/storage/.keep
32
+
33
+ /public/assets
34
+
35
+ # Ignore master key for decrypting credentials and more.
36
+ /config/master.key
data/dummy/Gemfile ADDED
@@ -0,0 +1,29 @@
1
+ source "https://rubygems.org"
2
+ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
3
+
4
+ gem "bootsnap", require: false
5
+ gem "rails", "~>7.1.0"
6
+ gem "sprockets-rails"
7
+ gem "sqlite3", "~> 1.4"
8
+ gem "importmap-rails"
9
+ gem "turbo-rails"
10
+ gem "stimulus-rails"
11
+ gem "bard-file_field", path: ".."
12
+
13
+ group :development do
14
+ gem "web-console"
15
+ end
16
+
17
+ group :test do
18
+ gem "simplecov"
19
+ gem "cucumber-rails", require: false
20
+ gem "cucumber", require: false, github: "botandrose/cucumber", branch: "restore_looser_line_numbers"
21
+ gem "cuprite-downloads"
22
+ gem "puma"
23
+ gem "capybara-screenshot"
24
+ gem "capybara-shadowdom"
25
+ gem "database_cleaner"
26
+ gem "rspec-rails"
27
+ gem "byebug"
28
+ end
29
+
@@ -0,0 +1,353 @@
1
+ GIT
2
+ remote: https://github.com/botandrose/cucumber.git
3
+ revision: 9758dc7747923a8037c24f7fe9c3759bcd2d243a
4
+ branch: restore_looser_line_numbers
5
+ specs:
6
+ cucumber (5.3.0)
7
+ builder (~> 3.2, >= 3.2.4)
8
+ cucumber-core (~> 8.0, >= 8.0.1)
9
+ cucumber-create-meta (~> 2.0, >= 2.0.2)
10
+ cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
11
+ cucumber-gherkin (~> 15.0, >= 15.0.2)
12
+ cucumber-html-formatter (~> 9.0, >= 9.0.0)
13
+ cucumber-messages (~> 13.1, >= 13.1.0)
14
+ cucumber-wire (~> 4.0, >= 4.0.1)
15
+ diff-lcs (~> 1.4, >= 1.4.4)
16
+ multi_test (~> 0.1, >= 0.1.2)
17
+ sys-uname (~> 1.2, >= 1.2.1)
18
+
19
+ PATH
20
+ remote: ..
21
+ specs:
22
+ bard-file_field (0.1.0)
23
+ activestorage (~> 7.1.0)
24
+
25
+ GEM
26
+ remote: https://rubygems.org/
27
+ specs:
28
+ actioncable (7.1.1)
29
+ actionpack (= 7.1.1)
30
+ activesupport (= 7.1.1)
31
+ nio4r (~> 2.0)
32
+ websocket-driver (>= 0.6.1)
33
+ zeitwerk (~> 2.6)
34
+ actionmailbox (7.1.1)
35
+ actionpack (= 7.1.1)
36
+ activejob (= 7.1.1)
37
+ activerecord (= 7.1.1)
38
+ activestorage (= 7.1.1)
39
+ activesupport (= 7.1.1)
40
+ mail (>= 2.7.1)
41
+ net-imap
42
+ net-pop
43
+ net-smtp
44
+ actionmailer (7.1.1)
45
+ actionpack (= 7.1.1)
46
+ actionview (= 7.1.1)
47
+ activejob (= 7.1.1)
48
+ activesupport (= 7.1.1)
49
+ mail (~> 2.5, >= 2.5.4)
50
+ net-imap
51
+ net-pop
52
+ net-smtp
53
+ rails-dom-testing (~> 2.2)
54
+ actionpack (7.1.1)
55
+ actionview (= 7.1.1)
56
+ activesupport (= 7.1.1)
57
+ nokogiri (>= 1.8.5)
58
+ rack (>= 2.2.4)
59
+ rack-session (>= 1.0.1)
60
+ rack-test (>= 0.6.3)
61
+ rails-dom-testing (~> 2.2)
62
+ rails-html-sanitizer (~> 1.6)
63
+ actiontext (7.1.1)
64
+ actionpack (= 7.1.1)
65
+ activerecord (= 7.1.1)
66
+ activestorage (= 7.1.1)
67
+ activesupport (= 7.1.1)
68
+ globalid (>= 0.6.0)
69
+ nokogiri (>= 1.8.5)
70
+ actionview (7.1.1)
71
+ activesupport (= 7.1.1)
72
+ builder (~> 3.1)
73
+ erubi (~> 1.11)
74
+ rails-dom-testing (~> 2.2)
75
+ rails-html-sanitizer (~> 1.6)
76
+ activejob (7.1.1)
77
+ activesupport (= 7.1.1)
78
+ globalid (>= 0.3.6)
79
+ activemodel (7.1.1)
80
+ activesupport (= 7.1.1)
81
+ activerecord (7.1.1)
82
+ activemodel (= 7.1.1)
83
+ activesupport (= 7.1.1)
84
+ timeout (>= 0.4.0)
85
+ activestorage (7.1.1)
86
+ actionpack (= 7.1.1)
87
+ activejob (= 7.1.1)
88
+ activerecord (= 7.1.1)
89
+ activesupport (= 7.1.1)
90
+ marcel (~> 1.0)
91
+ activesupport (7.1.1)
92
+ base64
93
+ bigdecimal
94
+ concurrent-ruby (~> 1.0, >= 1.0.2)
95
+ connection_pool (>= 2.2.5)
96
+ drb
97
+ i18n (>= 1.6, < 2)
98
+ minitest (>= 5.1)
99
+ mutex_m
100
+ tzinfo (~> 2.0)
101
+ addressable (2.8.5)
102
+ public_suffix (>= 2.0.2, < 6.0)
103
+ base64 (0.2.0)
104
+ bigdecimal (3.1.4)
105
+ bindex (0.8.1)
106
+ bootsnap (1.17.0)
107
+ msgpack (~> 1.2)
108
+ builder (3.2.4)
109
+ byebug (11.1.3)
110
+ capybara (3.39.2)
111
+ addressable
112
+ matrix
113
+ mini_mime (>= 0.1.3)
114
+ nokogiri (~> 1.8)
115
+ rack (>= 1.6.0)
116
+ rack-test (>= 0.6.3)
117
+ regexp_parser (>= 1.5, < 3.0)
118
+ xpath (~> 3.2)
119
+ capybara-screenshot (1.0.26)
120
+ capybara (>= 1.0, < 4)
121
+ launchy
122
+ capybara-shadowdom (0.3.0)
123
+ capybara
124
+ concurrent-ruby (1.2.2)
125
+ connection_pool (2.4.1)
126
+ crass (1.0.6)
127
+ cucumber-core (8.0.1)
128
+ cucumber-gherkin (~> 15.0, >= 15.0.2)
129
+ cucumber-messages (~> 13.0, >= 13.0.1)
130
+ cucumber-tag-expressions (~> 2.0, >= 2.0.4)
131
+ cucumber-create-meta (2.0.4)
132
+ cucumber-messages (~> 13.1, >= 13.1.0)
133
+ sys-uname (~> 1.2, >= 1.2.1)
134
+ cucumber-cucumber-expressions (10.3.0)
135
+ cucumber-gherkin (15.0.2)
136
+ cucumber-messages (~> 13.0, >= 13.0.1)
137
+ cucumber-html-formatter (9.0.0)
138
+ cucumber-messages (~> 13.0, >= 13.0.1)
139
+ cucumber-messages (13.2.1)
140
+ protobuf-cucumber (~> 3.10, >= 3.10.8)
141
+ cucumber-rails (3.0.0)
142
+ capybara (>= 3.11, < 4)
143
+ cucumber (>= 5, < 10)
144
+ railties (>= 5.2, < 8)
145
+ cucumber-tag-expressions (2.0.4)
146
+ cucumber-wire (4.0.1)
147
+ cucumber-core (~> 8.0, >= 8.0.1)
148
+ cucumber-cucumber-expressions (~> 10.3, >= 10.3.0)
149
+ cucumber-messages (~> 13.0, >= 13.0.1)
150
+ cuprite (0.15)
151
+ capybara (~> 3.0)
152
+ ferrum (~> 0.14.0)
153
+ cuprite-downloads (0.2.0)
154
+ cuprite
155
+ database_cleaner (2.0.2)
156
+ database_cleaner-active_record (>= 2, < 3)
157
+ database_cleaner-active_record (2.1.0)
158
+ activerecord (>= 5.a)
159
+ database_cleaner-core (~> 2.0.0)
160
+ database_cleaner-core (2.0.1)
161
+ date (3.3.4)
162
+ diff-lcs (1.5.0)
163
+ docile (1.4.0)
164
+ drb (2.2.0)
165
+ ruby2_keywords
166
+ erubi (1.12.0)
167
+ ferrum (0.14)
168
+ addressable (~> 2.5)
169
+ concurrent-ruby (~> 1.1)
170
+ webrick (~> 1.7)
171
+ websocket-driver (>= 0.6, < 0.8)
172
+ ffi (1.16.3)
173
+ globalid (1.2.1)
174
+ activesupport (>= 6.1)
175
+ i18n (1.14.1)
176
+ concurrent-ruby (~> 1.0)
177
+ importmap-rails (1.2.3)
178
+ actionpack (>= 6.0.0)
179
+ activesupport (>= 6.0.0)
180
+ railties (>= 6.0.0)
181
+ io-console (0.6.0)
182
+ irb (1.8.3)
183
+ rdoc
184
+ reline (>= 0.3.8)
185
+ launchy (2.5.2)
186
+ addressable (~> 2.8)
187
+ loofah (2.21.4)
188
+ crass (~> 1.0.2)
189
+ nokogiri (>= 1.12.0)
190
+ mail (2.8.1)
191
+ mini_mime (>= 0.1.1)
192
+ net-imap
193
+ net-pop
194
+ net-smtp
195
+ marcel (1.0.2)
196
+ matrix (0.4.2)
197
+ middleware (0.1.0)
198
+ mini_mime (1.1.5)
199
+ minitest (5.20.0)
200
+ msgpack (1.7.2)
201
+ multi_test (0.1.2)
202
+ mutex_m (0.2.0)
203
+ net-imap (0.4.4)
204
+ date
205
+ net-protocol
206
+ net-pop (0.1.2)
207
+ net-protocol
208
+ net-protocol (0.2.2)
209
+ timeout
210
+ net-smtp (0.4.0)
211
+ net-protocol
212
+ nio4r (2.5.9)
213
+ nokogiri (1.15.4-x86_64-linux)
214
+ racc (~> 1.4)
215
+ protobuf-cucumber (3.10.8)
216
+ activesupport (>= 3.2)
217
+ middleware
218
+ thor
219
+ thread_safe
220
+ psych (5.1.1.1)
221
+ stringio
222
+ public_suffix (5.0.3)
223
+ puma (6.4.0)
224
+ nio4r (~> 2.0)
225
+ racc (1.7.3)
226
+ rack (3.0.8)
227
+ rack-session (2.0.0)
228
+ rack (>= 3.0.0)
229
+ rack-test (2.1.0)
230
+ rack (>= 1.3)
231
+ rackup (2.1.0)
232
+ rack (>= 3)
233
+ webrick (~> 1.8)
234
+ rails (7.1.1)
235
+ actioncable (= 7.1.1)
236
+ actionmailbox (= 7.1.1)
237
+ actionmailer (= 7.1.1)
238
+ actionpack (= 7.1.1)
239
+ actiontext (= 7.1.1)
240
+ actionview (= 7.1.1)
241
+ activejob (= 7.1.1)
242
+ activemodel (= 7.1.1)
243
+ activerecord (= 7.1.1)
244
+ activestorage (= 7.1.1)
245
+ activesupport (= 7.1.1)
246
+ bundler (>= 1.15.0)
247
+ railties (= 7.1.1)
248
+ rails-dom-testing (2.2.0)
249
+ activesupport (>= 5.0.0)
250
+ minitest
251
+ nokogiri (>= 1.6)
252
+ rails-html-sanitizer (1.6.0)
253
+ loofah (~> 2.21)
254
+ nokogiri (~> 1.14)
255
+ railties (7.1.1)
256
+ actionpack (= 7.1.1)
257
+ activesupport (= 7.1.1)
258
+ irb
259
+ rackup (>= 1.0.0)
260
+ rake (>= 12.2)
261
+ thor (~> 1.0, >= 1.2.2)
262
+ zeitwerk (~> 2.6)
263
+ rake (13.1.0)
264
+ rdoc (6.6.0)
265
+ psych (>= 4.0.0)
266
+ regexp_parser (2.8.2)
267
+ reline (0.4.0)
268
+ io-console (~> 0.5)
269
+ rspec-core (3.12.2)
270
+ rspec-support (~> 3.12.0)
271
+ rspec-expectations (3.12.3)
272
+ diff-lcs (>= 1.2.0, < 2.0)
273
+ rspec-support (~> 3.12.0)
274
+ rspec-mocks (3.12.6)
275
+ diff-lcs (>= 1.2.0, < 2.0)
276
+ rspec-support (~> 3.12.0)
277
+ rspec-rails (6.0.3)
278
+ actionpack (>= 6.1)
279
+ activesupport (>= 6.1)
280
+ railties (>= 6.1)
281
+ rspec-core (~> 3.12)
282
+ rspec-expectations (~> 3.12)
283
+ rspec-mocks (~> 3.12)
284
+ rspec-support (~> 3.12)
285
+ rspec-support (3.12.1)
286
+ ruby2_keywords (0.0.5)
287
+ simplecov (0.22.0)
288
+ docile (~> 1.1)
289
+ simplecov-html (~> 0.11)
290
+ simplecov_json_formatter (~> 0.1)
291
+ simplecov-html (0.12.3)
292
+ simplecov_json_formatter (0.1.4)
293
+ sprockets (4.2.1)
294
+ concurrent-ruby (~> 1.0)
295
+ rack (>= 2.2.4, < 4)
296
+ sprockets-rails (3.4.2)
297
+ actionpack (>= 5.2)
298
+ activesupport (>= 5.2)
299
+ sprockets (>= 3.0.0)
300
+ sqlite3 (1.6.8-x86_64-linux)
301
+ stimulus-rails (1.3.0)
302
+ railties (>= 6.0.0)
303
+ stringio (3.0.9)
304
+ sys-uname (1.2.3)
305
+ ffi (~> 1.1)
306
+ thor (1.3.0)
307
+ thread_safe (0.3.6)
308
+ timeout (0.4.1)
309
+ turbo-rails (1.5.0)
310
+ actionpack (>= 6.0.0)
311
+ activejob (>= 6.0.0)
312
+ railties (>= 6.0.0)
313
+ tzinfo (2.0.6)
314
+ concurrent-ruby (~> 1.0)
315
+ web-console (4.2.1)
316
+ actionview (>= 6.0.0)
317
+ activemodel (>= 6.0.0)
318
+ bindex (>= 0.4.0)
319
+ railties (>= 6.0.0)
320
+ webrick (1.8.1)
321
+ websocket-driver (0.7.6)
322
+ websocket-extensions (>= 0.1.0)
323
+ websocket-extensions (0.1.5)
324
+ xpath (3.2.0)
325
+ nokogiri (~> 1.8)
326
+ zeitwerk (2.6.12)
327
+
328
+ PLATFORMS
329
+ x86_64-linux
330
+
331
+ DEPENDENCIES
332
+ bard-file_field!
333
+ bootsnap
334
+ byebug
335
+ capybara-screenshot
336
+ capybara-shadowdom
337
+ cucumber!
338
+ cucumber-rails
339
+ cuprite-downloads
340
+ database_cleaner
341
+ importmap-rails
342
+ puma
343
+ rails (~> 7.1.0)
344
+ rspec-rails
345
+ simplecov
346
+ sprockets-rails
347
+ sqlite3 (~> 1.4)
348
+ stimulus-rails
349
+ turbo-rails
350
+ web-console
351
+
352
+ BUNDLED WITH
353
+ 2.3.26
data/dummy/README.md ADDED
@@ -0,0 +1,24 @@
1
+ # README
2
+
3
+ This README would normally document whatever steps are necessary to get the
4
+ application up and running.
5
+
6
+ Things you may want to cover:
7
+
8
+ * Ruby version
9
+
10
+ * System dependencies
11
+
12
+ * Configuration
13
+
14
+ * Database creation
15
+
16
+ * Database initialization
17
+
18
+ * How to run the test suite
19
+
20
+ * Services (job queues, cache servers, search engines, etc.)
21
+
22
+ * Deployment instructions
23
+
24
+ * ...
data/dummy/Rakefile ADDED
@@ -0,0 +1,13 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative "config/application"
5
+
6
+ Rails.application.load_tasks
7
+
8
+ require 'cucumber/rake/task'
9
+
10
+ Cucumber::Rake::Task.new({:default => 'test:prepare'}, 'Run features that should pass') do |t|
11
+ t.fork = true # You may get faster startup if you set this to false
12
+ t.profile = 'default'
13
+ end
@@ -0,0 +1,3 @@
1
+ //= link_tree ../images
2
+ //= link_directory ../stylesheets .css
3
+ //= link_tree ../../javascript .js
File without changes
@@ -0,0 +1,22 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's
6
+ * vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
16
+
17
+ .alert {
18
+ background-color: red
19
+ }
20
+ .notice {
21
+ background-color: green
22
+ }
@@ -0,0 +1,2 @@
1
+ class ApplicationController < ActionController::Base
2
+ end
File without changes
@@ -0,0 +1,23 @@
1
+ class EdgeCasesController < ApplicationController
2
+ def show
3
+ @post = Post.find_or_initialize_by(id: params[:post_id])
4
+ render action: params[:id]
5
+ end
6
+
7
+ def update
8
+ @post = Post.new(post_params)
9
+ if @post.save
10
+ redirect_to({ id: params[:id], post_id: @post.id }, notice: "Post created!")
11
+ else
12
+ flash.now.alert = @post.errors.full_messages.join("<br>")
13
+ render action: params[:id]
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def post_params
20
+ params.require(:post).permit!
21
+ end
22
+ end
23
+
@@ -0,0 +1,33 @@
1
+ class PostsController < ApplicationController
2
+ def new
3
+ @post = Post.new
4
+ render :form
5
+ end
6
+
7
+ def create
8
+ @post = Post.create!(post_params)
9
+ redirect_to @post, notice: "Post created!"
10
+ end
11
+
12
+ def show
13
+ @post = Post.find(params[:id])
14
+ end
15
+
16
+ def edit
17
+ @post = Post.find(params[:id])
18
+ render :form
19
+ end
20
+
21
+ def update
22
+ @post = Post.find(params[:id])
23
+ @post.update!(post_params)
24
+ redirect_to @post, notice: "Post updated!"
25
+ end
26
+
27
+ private
28
+
29
+ def post_params
30
+ params.require(:post).permit!
31
+ end
32
+ end
33
+
@@ -0,0 +1,18 @@
1
+ class ValidationsController < ApplicationController
2
+ def show
3
+ @post = Post.find_or_initialize_by(id: params[:post_id])
4
+ render action: params[:id]
5
+ end
6
+
7
+ def update
8
+ @post = Post.create!(post_params)
9
+ redirect_to({ id: params[:id], post_id: @post.id }, notice: "Post created!")
10
+ end
11
+
12
+ private
13
+
14
+ def post_params
15
+ params.require(:post).permit!
16
+ end
17
+ end
18
+