Class: Pinspec::FactoryIndex
- Inherits:
-
Data
- Object
- Data
- Pinspec::FactoryIndex
- Defined in:
- lib/pinspec/types.rb
Instance Attribute Summary collapse
-
#factories ⇒ Object
readonly
Returns the value of attribute factories.
-
#legacy_dsl ⇒ Object
readonly
Returns the value of attribute legacy_dsl.
-
#skipped ⇒ Object
readonly
Returns the value of attribute skipped.
Instance Method Summary collapse
Instance Attribute Details
#factories ⇒ Object (readonly)
Returns the value of attribute factories
345 346 347 |
# File 'lib/pinspec/types.rb', line 345 def factories @factories end |
#legacy_dsl ⇒ Object (readonly)
Returns the value of attribute legacy_dsl
345 346 347 |
# File 'lib/pinspec/types.rb', line 345 def legacy_dsl @legacy_dsl end |
#skipped ⇒ Object (readonly)
Returns the value of attribute skipped
345 346 347 |
# File 'lib/pinspec/types.rb', line 345 def skipped @skipped end |
Instance Method Details
#dsl_module ⇒ Object
357 358 359 |
# File 'lib/pinspec/types.rb', line 357 def dsl_module legacy_dsl ? "FactoryGirl" : "FactoryBot" end |
#factory(name) ⇒ Object
346 347 348 349 350 351 |
# File 'lib/pinspec/types.rb', line 346 def factory(name) wanted = name.to_sym factories.find { |f| f.name == wanted } || factories.find { |f| f.aliases.include?(wanted) } end |
#for_model(model) ⇒ Object
353 354 355 |
# File 'lib/pinspec/types.rb', line 353 def for_model(model) factories.select { |f| f.model == model.to_s } end |