Class: ViewSpec::Scenario
Defined Under Namespace
Classes: NoPreviewError
Instance Method Summary
collapse
#controller
#layout
#param, #params, #resolve_params
Methods included from DSL::Title
#title
#entries, #initialize, lookup_attr, lookup_attrs, type
Instance Method Details
#name ⇒ Object
25
26
27
|
# File 'lib/view_spec/scenario.rb', line 25
def name
@subject.to_s
end
|
#preview(tpl = nil, &block) ⇒ Object
10
11
12
|
# File 'lib/view_spec/scenario.rb', line 10
def preview(tpl = nil, &block)
@preview = tpl || block
end
|
#render_output(*args, **kwargs) ⇒ Object
21
22
23
|
# File 'lib/view_spec/scenario.rb', line 21
def render_output(*args, **kwargs)
render_preview(*args, **kwargs, raw: true)
end
|
#render_preview(params: {}, assigns: {}, layout: false, raw: false) ⇒ Object
14
15
16
17
18
19
|
# File 'lib/view_spec/scenario.rb', line 14
def render_preview(params: {}, assigns: {}, layout: false, raw: false)
assigns[:params] = resolve_params(params).to_h
html = render(renderable_preview, layout:, assigns:)
raw ? CGI.unescapeHTML(html) : html
end
|
#short_identifier ⇒ Object
29
30
31
|
# File 'lib/view_spec/scenario.rb', line 29
def short_identifier
@subject.to_short_identifier
end
|
#to_param ⇒ Object
33
34
35
|
# File 'lib/view_spec/scenario.rb', line 33
def to_param
short_identifier
end
|
#to_partial_path ⇒ Object
37
38
39
|
# File 'lib/view_spec/scenario.rb', line 37
def to_partial_path
"view_spec/scenario"
end
|