Class: ViewSpec::Group

Inherits:
Entry
  • Object
show all
Defined in:
lib/view_spec/group.rb

Instance Method Summary collapse

Methods inherited from Entry

#initialize, #method_missing, #respond_to_missing?, #short_identifier, #source_file, #spec, #title, #to_partial_path, type

Constructor Details

This class inherits a constructor from ViewSpec::Entry

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ViewSpec::Entry

Instance Method Details

#notesObject



11
12
13
14
15
16
17
18
# File 'lib/view_spec/group.rb', line 11

def notes
  if context.notes.present? || scenarios.filter { _1.notes? }.any?
    ViewSpec.config.preview_controller.render(
      partial: "view_specs/group/notes",
      locals: {group: self, notes: context.notes}
    )
  end
end

#notes?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/view_spec/group.rb', line 20

def notes?
  notes.present?
end

#preview(**options) ⇒ Object



3
4
5
# File 'lib/view_spec/group.rb', line 3

def preview(**options)
  GroupPreview.new(self, **options)
end

#preview?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/view_spec/group.rb', line 7

def preview?
  scenarios.any? { _1.preview? }
end

#to_paramObject



24
25
26
# File 'lib/view_spec/group.rb', line 24

def to_param
  short_identifier
end