mirror of
https://github.com/thoughtbot/factory_bot_rails.git
synced 2022-11-09 11:49:18 -05:00
Remove unneeded conditional for app_generators
Configuration#generators was deprecated in favor of
Configuration#app_generators back in Rails 3.1
(04cbabb0a0
).
Since we started work on factory_bot_rails 5, which only supports Rails
4.2+, we no longer need the conditional.
I also updated the development Gemfile, since it was out of date,
and replaced a nested if/else with elsif.
This commit is contained in:
parent
02a0f58487
commit
affd0771bf
3 changed files with 11 additions and 18 deletions
|
@ -1,8 +1,8 @@
|
|||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
factory_bot_rails (4.10.0)
|
||||
factory_bot (~> 4.10.0)
|
||||
factory_bot_rails (4.11.1)
|
||||
factory_bot (~> 4.11.1)
|
||||
railties (>= 3.0.0)
|
||||
|
||||
GEM
|
||||
|
@ -72,7 +72,7 @@ GEM
|
|||
diff-lcs (1.3)
|
||||
erubi (1.7.1)
|
||||
execjs (2.7.0)
|
||||
factory_bot (4.10.0)
|
||||
factory_bot (4.11.1)
|
||||
activesupport (>= 3.0.0)
|
||||
ffi (1.9.25)
|
||||
ffi (1.9.25-java)
|
||||
|
@ -168,4 +168,4 @@ DEPENDENCIES
|
|||
uglifier
|
||||
|
||||
BUNDLED WITH
|
||||
1.16.2
|
||||
1.16.3
|
||||
|
|
|
@ -5,11 +5,7 @@ require 'factory_bot_rails/generators/null_generator'
|
|||
module FactoryBotRails
|
||||
class Generator
|
||||
def initialize(config)
|
||||
@generators = if config.respond_to?(:app_generators)
|
||||
config.app_generators
|
||||
else
|
||||
config.generators
|
||||
end
|
||||
@generators = config.app_generators
|
||||
end
|
||||
|
||||
def run
|
||||
|
@ -17,14 +13,12 @@ module FactoryBotRails
|
|||
end
|
||||
|
||||
def generator
|
||||
if factory_bot_disabled?
|
||||
Generators::NullGenerator
|
||||
return Generators::NullGenerator if factory_bot_disabled?
|
||||
|
||||
if test_framework == :rspec
|
||||
Generators::RSpecGenerator
|
||||
else
|
||||
if test_framework == :rspec
|
||||
Generators::RSpecGenerator
|
||||
else
|
||||
Generators::NonRSpecGenerator
|
||||
end
|
||||
Generators::NonRSpecGenerator
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -91,8 +91,7 @@ RUBY
|
|||
end
|
||||
|
||||
def generators
|
||||
config = FactoryBotRails::Railtie.config
|
||||
config.respond_to?(:app_generators) ? config.app_generators : config.generators
|
||||
FactoryBotRails::Railtie.config.app_generators
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue