Class: ViewSpec::Spec
Instance Attribute Summary collapse
-
#source_file ⇒ Object
readonly
Returns the value of attribute source_file.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
Instance Method Summary collapse
-
#initialize(source_file, subject, &block) ⇒ Spec
constructor
A new instance of Spec.
- #lookup_path ⇒ Object
- #previews? ⇒ Boolean
- #to_param ⇒ Object
Methods inherited from Entry
#method_missing, #respond_to_missing?, #short_identifier, #spec, #title, #to_partial_path, type
Constructor Details
#initialize(source_file, subject, &block) ⇒ Spec
Returns a new instance of Spec.
5 6 7 8 9 |
# File 'lib/view_spec/spec.rb', line 5 def initialize(source_file, subject, &block) @source_file = source_file super(subject, nil, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ViewSpec::Entry
Instance Attribute Details
#source_file ⇒ Object (readonly)
Returns the value of attribute source_file.
3 4 5 |
# File 'lib/view_spec/spec.rb', line 3 def source_file @source_file end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
3 4 5 |
# File 'lib/view_spec/spec.rb', line 3 def subject @subject end |
Instance Method Details
#lookup_path ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/view_spec/spec.rb', line 11 def lookup_path if @source_file.spec_file? @source_file.lookup_path else short_identifier end end |
#previews? ⇒ Boolean
23 24 25 |
# File 'lib/view_spec/spec.rb', line 23 def previews? scenarios(flatten: true).select { _1.preview? }.any? end |
#to_param ⇒ Object
19 20 21 |
# File 'lib/view_spec/spec.rb', line 19 def to_param lookup_path end |