From 1455dc140092bba9e0c5c454550b63c577837e5e Mon Sep 17 00:00:00 2001 From: Steve Polito Date: Wed, 8 Nov 2023 15:46:54 -0500 Subject: [PATCH] Rename `factory_bot` -> `factories` --- NEWS.md | 2 +- README.md | 4 ++-- ...ctory_bot_generator.rb => factories_generator.rb} | 4 ++-- .../{factory_bot => factories}/factories.rb | 0 .../{factory_bot => factories}/factories_spec.rb | 0 .../{factory_bot => factories}/factories_test.rb | 0 .../{factory_bot => factories}/factory_bot_rspec.rb | 0 ...generator_test.rb => factories_generator_test.rb} | 12 ++++++------ 8 files changed, 11 insertions(+), 11 deletions(-) rename lib/generators/suspenders/{factory_bot_generator.rb => factories_generator.rb} (93%) rename lib/generators/templates/{factory_bot => factories}/factories.rb (100%) rename lib/generators/templates/{factory_bot => factories}/factories_spec.rb (100%) rename lib/generators/templates/{factory_bot => factories}/factories_test.rb (100%) rename lib/generators/templates/{factory_bot => factories}/factory_bot_rspec.rb (100%) rename test/generators/suspenders/{factory_bot_generator_test.rb => factories_generator_test.rb} (92%) diff --git a/NEWS.md b/NEWS.md index 684f4ded0..f923baa70 100644 --- a/NEWS.md +++ b/NEWS.md @@ -3,7 +3,7 @@ Unreleased * Remove `suspenders` system executable * Introduce `suspenders:accessibility` generator * Introduce `Suspenders::Generators::APIAppUnsupported` module and concern -* Introduce `suspenders:factory_bot` generator +* Introduce `suspenders:factories` generator 20230113.0 (January, 13, 2023) diff --git a/README.md b/README.md index e09ce923f..ded1f2373 100644 --- a/README.md +++ b/README.md @@ -30,11 +30,11 @@ Installs [capybara_accessibility_audit] and [capybara_accessible_selectors] [capybara_accessibility_audit]: https://github.com/thoughtbot/capybara_accessibility_audit [capybara_accessible_selectors]: https://github.com/citizensadvice/capybara_accessible_selectors -### Factory Bot +### Factories Installs and configures [factory_bot_rails]. Supports the [default test suite] and [RSpec]. -`./bin/rails g suspenders:factory_bot` +`./bin/rails g suspenders:factories` [factory_bot_rails]: https://github.com/thoughtbot/factory_bot_rails [default test suite]: https://guides.rubyonrails.org/testing.html diff --git a/lib/generators/suspenders/factory_bot_generator.rb b/lib/generators/suspenders/factories_generator.rb similarity index 93% rename from lib/generators/suspenders/factory_bot_generator.rb rename to lib/generators/suspenders/factories_generator.rb index 2cea1b771..067c7290b 100644 --- a/lib/generators/suspenders/factory_bot_generator.rb +++ b/lib/generators/suspenders/factories_generator.rb @@ -1,7 +1,7 @@ module Suspenders module Generators - class FactoryBotGenerator < Rails::Generators::Base - source_root File.expand_path("../../templates/factory_bot", __FILE__) + class FactoriesGenerator < Rails::Generators::Base + source_root File.expand_path("../../templates/factories", __FILE__) desc "Installs and configures factory_bot_rails. Supports the default test suite and RSpec." def add_factory_bot diff --git a/lib/generators/templates/factory_bot/factories.rb b/lib/generators/templates/factories/factories.rb similarity index 100% rename from lib/generators/templates/factory_bot/factories.rb rename to lib/generators/templates/factories/factories.rb diff --git a/lib/generators/templates/factory_bot/factories_spec.rb b/lib/generators/templates/factories/factories_spec.rb similarity index 100% rename from lib/generators/templates/factory_bot/factories_spec.rb rename to lib/generators/templates/factories/factories_spec.rb diff --git a/lib/generators/templates/factory_bot/factories_test.rb b/lib/generators/templates/factories/factories_test.rb similarity index 100% rename from lib/generators/templates/factory_bot/factories_test.rb rename to lib/generators/templates/factories/factories_test.rb diff --git a/lib/generators/templates/factory_bot/factory_bot_rspec.rb b/lib/generators/templates/factories/factory_bot_rspec.rb similarity index 100% rename from lib/generators/templates/factory_bot/factory_bot_rspec.rb rename to lib/generators/templates/factories/factory_bot_rspec.rb diff --git a/test/generators/suspenders/factory_bot_generator_test.rb b/test/generators/suspenders/factories_generator_test.rb similarity index 92% rename from test/generators/suspenders/factory_bot_generator_test.rb rename to test/generators/suspenders/factories_generator_test.rb index 39edf91fc..36eb03d5e 100644 --- a/test/generators/suspenders/factory_bot_generator_test.rb +++ b/test/generators/suspenders/factories_generator_test.rb @@ -1,12 +1,12 @@ require "test_helper" -require "generators/suspenders/factory_bot_generator" +require "generators/suspenders/factories_generator" module Suspenders module Generators - class FactoryBotGenerator::DefaultTest < Rails::Generators::TestCase + class FactoriesGenerator::DefaultTest < Rails::Generators::TestCase include Suspenders::TestHelpers - tests Suspenders::Generators::FactoryBotGenerator + tests Suspenders::Generators::FactoriesGenerator destination Rails.root setup :prepare_destination teardown :restore_destination @@ -14,7 +14,7 @@ class FactoryBotGenerator::DefaultTest < Rails::Generators::TestCase test "generator has a description" do description = "Installs and configures factory_bot_rails. Supports the default test suite and RSpec." - assert_equal description, FactoryBotGenerator.desc + assert_equal description, FactoriesGenerator.desc end test "installs gem with Bundler" do @@ -121,10 +121,10 @@ class TestCase end end - class FactoryBotGenerator::RSpecTest < Rails::Generators::TestCase + class FactoriesGenerator::RSpecTest < Rails::Generators::TestCase include Suspenders::TestHelpers - tests Suspenders::Generators::FactoryBotGenerator + tests Suspenders::Generators::FactoriesGenerator destination Rails.root setup :prepare_destination teardown :restore_destination