7
7
require "rails/engine/updater"
8
8
9
9
DEFAULT_PLUGIN_FILES = %w(
10
+ .git
10
11
.gitignore
11
12
Gemfile
12
- Rakefile
13
+ MIT-LICENSE
13
14
README.md
15
+ Rakefile
16
+ bin/test
14
17
bukkits.gemspec
15
- MIT-LICENSE
16
- lib
17
18
lib/bukkits.rb
18
- lib/tasks/bukkits_tasks.rake
19
+ lib/bukkits/railtie.rb
19
20
lib/bukkits/version.rb
21
+ lib/tasks/bukkits_tasks.rake
20
22
test/bukkits_test.rb
23
+ test/dummy/Rakefile
24
+ test/dummy/app/assets/images/.keep
25
+ test/dummy/app/assets/stylesheets/application.css
26
+ test/dummy/app/channels/application_cable/channel.rb
27
+ test/dummy/app/channels/application_cable/connection.rb
28
+ test/dummy/app/controllers/application_controller.rb
29
+ test/dummy/app/controllers/concerns/.keep
30
+ test/dummy/app/helpers/application_helper.rb
31
+ test/dummy/app/jobs/application_job.rb
32
+ test/dummy/app/mailers/application_mailer.rb
33
+ test/dummy/app/models/application_record.rb
34
+ test/dummy/app/models/concerns/.keep
35
+ test/dummy/app/views/layouts/application.html.erb
36
+ test/dummy/app/views/layouts/mailer.html.erb
37
+ test/dummy/app/views/layouts/mailer.text.erb
38
+ test/dummy/app/views/pwa/manifest.json.erb
39
+ test/dummy/app/views/pwa/service-worker.js
40
+ test/dummy/bin/rails
41
+ test/dummy/bin/rake
42
+ test/dummy/bin/setup
43
+ test/dummy/config.ru
44
+ test/dummy/config/application.rb
45
+ test/dummy/config/boot.rb
46
+ test/dummy/config/cable.yml
47
+ test/dummy/config/database.yml
48
+ test/dummy/config/environment.rb
49
+ test/dummy/config/environments/development.rb
50
+ test/dummy/config/environments/production.rb
51
+ test/dummy/config/environments/test.rb
52
+ test/dummy/config/initializers/content_security_policy.rb
53
+ test/dummy/config/initializers/enable_yjit.rb
54
+ test/dummy/config/initializers/filter_parameter_logging.rb
55
+ test/dummy/config/initializers/inflections.rb
56
+ test/dummy/config/initializers/permissions_policy.rb
57
+ test/dummy/config/locales/en.yml
58
+ test/dummy/config/puma.rb
59
+ test/dummy/config/routes.rb
60
+ test/dummy/config/storage.yml
61
+ test/dummy/lib/assets/.keep
62
+ test/dummy/log/.keep
63
+ test/dummy/public/404.html
64
+ test/dummy/public/422.html
65
+ test/dummy/public/426.html
66
+ test/dummy/public/500.html
67
+ test/dummy/public/icon.png
68
+ test/dummy/public/icon.svg
69
+ test/dummy/storage/.keep
70
+ test/dummy/tmp/.keep
71
+ test/dummy/tmp/pids/.keep
72
+ test/dummy/tmp/storage/.keep
21
73
test/test_helper.rb
22
- test/dummy
23
74
)
24
75
25
76
class PluginGeneratorTest < Rails ::Generators ::TestCase
@@ -68,8 +119,6 @@ def test_correct_file_in_lib_folder_of_camelcase_plugin_name
68
119
def test_generating_without_options
69
120
run_generator
70
121
assert_file "README.md" , /Bukkits/
71
- assert_no_file "config/routes.rb"
72
- assert_no_file "app/assets/config/bukkits_manifest.js"
73
122
assert_file "test/test_helper.rb" do |content |
74
123
assert_match ( /require_relative.+test\/ dummy\/ config\/ environment/ , content )
75
124
assert_match ( /ActiveRecord::Migrator\. migrations_paths.+test\/ dummy\/ db\/ migrate/ , content )
@@ -83,13 +132,6 @@ def test_generating_without_options
83
132
assert_match ( /class BukkitsTest < ActiveSupport::TestCase/ , content )
84
133
assert_match ( /assert Bukkits::VERSION/ , content )
85
134
end
86
- assert_file "bin/test"
87
- assert_no_file "bin/rails"
88
- end
89
-
90
- def test_initializes_git_repo
91
- run_generator
92
- assert_directory ".git"
93
135
end
94
136
95
137
def test_initializes_git_repo_with_main_branch_without_user_default
@@ -176,12 +218,6 @@ def test_generating_adds_dummy_app_rake_tasks_without_unit_test_files
176
218
assert_file "bin/rails" , /APP_PATH/
177
219
end
178
220
179
- def test_generating_adds_dummy_app_without_javascript_and_assets_deps
180
- run_generator
181
-
182
- assert_file "test/dummy/app/assets/stylesheets/application.css"
183
- end
184
-
185
221
def test_ensure_that_plugin_options_are_not_passed_to_app_generator
186
222
FileUtils . cd ( fixtures_root )
187
223
assert_no_match ( /It works from file!.*It works_from_file/ , run_generator ( [ destination_root , "-m" , "lib/template.rb" ] ) )
@@ -608,24 +644,6 @@ def test_ensure_that_gitignore_can_be_generated_from_a_template_for_dummy_path
608
644
end
609
645
end
610
646
611
- def test_unnecessary_files_are_not_generated_in_dummy_application
612
- run_generator
613
- assert_no_file "test/dummy/.gitignore"
614
- assert_no_file "test/dummy/.ruby-version"
615
- assert_no_file "test/dummy/db/seeds.rb"
616
- assert_no_file "test/dummy/Gemfile"
617
- assert_no_file "test/dummy/public/robots.txt"
618
- assert_no_file "test/dummy/README.md"
619
- assert_no_file "test/dummy/config/master.key"
620
- assert_no_file "test/dummy/config/credentials.yml.enc"
621
- assert_no_file "test/dummy/Dockerfile"
622
- assert_no_file "test/dummy/.dockerignore"
623
- assert_no_directory "test/dummy/lib/tasks"
624
- assert_no_directory "test/dummy/test"
625
- assert_no_directory "test/dummy/vendor"
626
- assert_no_directory "test/dummy/.git"
627
- end
628
-
629
647
def test_skipping_test_files
630
648
run_generator [ destination_root , "--skip-test" ]
631
649
assert_no_directory "test"
0 commit comments