Module: ModelParentHelpers
- Defined in:
- lib/generators/templet/templates/core/spec/support/core/model_parent_helpers.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/generators/templet/templates/core/spec/support/core/model_parent_helpers.rb', line 3 def self.included(base) base.class_eval do # TODO: change! let(:scope) { nil } # TODO: change! let(:new_model) { build :answer } # TODO: change! let(:model) { create :answer } # TODO: change! let(:parent) { model.question } # TODO: change! let(:grand_parent) { parent.category } # The following can be left alone let(:model_plural) { model.model_name.plural } let(:parent_plural) { parent.model_name.plural } let(:grand_parent_singular) { grand_parent.model_name.singular } let(:grand_parent_plural) { grand_parent.model_name.plural } end end |
Instance Method Details
#path_re(prefix: '', suffix: '', parent: parent_plural, model: model_plural) ⇒ Object
32 33 34 |
# File 'lib/generators/templet/templates/core/spec/support/core/model_parent_helpers.rb', line 32 def path_re(prefix: '', suffix: '', parent: parent_plural, model: model_plural) %r(^#{prefix}#{scope and '/' + scope}/#{parent}/\d+/#{model}#{suffix}$) end |