Class: ViewSpec::Spec

Inherits:
DSL::Context show all
Includes:
DSL::Controller, DSL::Groups, DSL::Layout, DSL::Scenarios, DSL::Title
Defined in:
lib/view_spec/spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DSL::Controller

#controller

Methods included from DSL::Scenarios

#scenario, #scenarios

Methods included from DSL::Groups

#group, #groups

Methods included from DSL::Layout

#layout

Methods included from DSL::Title

#title

Methods inherited from DSL::Context

#entries, lookup_attr, lookup_attrs, type

Constructor Details

#initialize(source_file, subject, &block) ⇒ Spec

Returns a new instance of Spec.



11
12
13
14
15
# File 'lib/view_spec/spec.rb', line 11

def initialize(source_file, subject, &block)
  @source_file = source_file

  super(subject, nil, &block)
end

Instance Attribute Details

#source_fileObject (readonly)

Returns the value of attribute source_file.



9
10
11
# File 'lib/view_spec/spec.rb', line 9

def source_file
  @source_file
end

#subjectObject (readonly)

Returns the value of attribute subject.



9
10
11
# File 'lib/view_spec/spec.rb', line 9

def subject
  @subject
end

Instance Method Details

#lookup_pathObject



21
22
23
24
25
26
27
# File 'lib/view_spec/spec.rb', line 21

def lookup_path
  if @source_file.spec_file?
    @source_file.lookup_path
  else
    short_identifier
  end
end

#short_identifierObject



17
18
19
# File 'lib/view_spec/spec.rb', line 17

def short_identifier
  @subject.to_short_identifier
end

#to_paramObject



29
30
31
# File 'lib/view_spec/spec.rb', line 29

def to_param
  lookup_path
end

#to_partial_pathObject



33
34
35
# File 'lib/view_spec/spec.rb', line 33

def to_partial_path
  "view_spec/spec"
end