Skip to content

Commit

Permalink
Rename factory_bot -> factories
Browse files Browse the repository at this point in the history
  • Loading branch information
stevepolitodesign committed Nov 8, 2023
1 parent e2e3f0b commit 1455dc1
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
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

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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1455dc1

Please sign in to comment.