Class: ViewSpec::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/view_spec/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.defaults ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/view_spec/config.rb', line 17

def defaults
  ActiveSupport::OrderedOptions.new.merge!({
    spec_paths: ["#{Rails.root}/test/view_specs"],
    spec_files: [],
    spec_file_suffix: "_vspec",

    preview_controller: "ViewSpecPreviewsController",
    preview_layout: nil,
    preview_route: "rails/view_spec/previews",
    show_previews: Rails.env.development? || Rails.env.test?,

    markdown_extensions: {
      tables: true,
      fenced_code_blocks: true,
      disable_indented_code_blocks: true,
      strikethrough: true,
      highlight: true,
      with_toc_data: true,
      lax_spacing: true,
      escape_html: false
    }
  })
end

Instance Method Details

#preview_controller ⇒ Object



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

def preview_controller
  config.preview_controller.is_a?(String) ? config.preview_controller.constantize : config.preview_controller
end

#preview_controller_name ⇒ Object



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

def preview_controller_name
  preview_controller = config.preview_controller.is_a?(Class) ? config.preview_controller.name : config.preview_controller
  preview_controller.underscore.sub(/_controller$/, "")
end