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
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
factory_bot_rails (4.10.0)
|
factory_bot_rails (4.11.1)
|
||||||
factory_bot (~> 4.10.0)
|
factory_bot (~> 4.11.1)
|
||||||
railties (>= 3.0.0)
|
railties (>= 3.0.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
|
@ -72,7 +72,7 @@ GEM
|
||||||
diff-lcs (1.3)
|
diff-lcs (1.3)
|
||||||
erubi (1.7.1)
|
erubi (1.7.1)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
factory_bot (4.10.0)
|
factory_bot (4.11.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
ffi (1.9.25)
|
ffi (1.9.25)
|
||||||
ffi (1.9.25-java)
|
ffi (1.9.25-java)
|
||||||
|
@ -168,4 +168,4 @@ DEPENDENCIES
|
||||||
uglifier
|
uglifier
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.16.2
|
1.16.3
|
||||||
|
|
|
@ -5,11 +5,7 @@ require 'factory_bot_rails/generators/null_generator'
|
||||||
module FactoryBotRails
|
module FactoryBotRails
|
||||||
class Generator
|
class Generator
|
||||||
def initialize(config)
|
def initialize(config)
|
||||||
@generators = if config.respond_to?(:app_generators)
|
@generators = config.app_generators
|
||||||
config.app_generators
|
|
||||||
else
|
|
||||||
config.generators
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def run
|
def run
|
||||||
|
@ -17,14 +13,12 @@ module FactoryBotRails
|
||||||
end
|
end
|
||||||
|
|
||||||
def generator
|
def generator
|
||||||
if factory_bot_disabled?
|
return Generators::NullGenerator if factory_bot_disabled?
|
||||||
Generators::NullGenerator
|
|
||||||
|
if test_framework == :rspec
|
||||||
|
Generators::RSpecGenerator
|
||||||
else
|
else
|
||||||
if test_framework == :rspec
|
Generators::NonRSpecGenerator
|
||||||
Generators::RSpecGenerator
|
|
||||||
else
|
|
||||||
Generators::NonRSpecGenerator
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -91,8 +91,7 @@ RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
def generators
|
def generators
|
||||||
config = FactoryBotRails::Railtie.config
|
FactoryBotRails::Railtie.config.app_generators
|
||||||
config.respond_to?(:app_generators) ? config.app_generators : config.generators
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue