Class: SpectacularRails::SpecController

Inherits:
ApplicationController show all
Defined in:
app/controllers/spectacular_rails/spec_controller.rb

Instance Method Summary collapse

Instance Method Details

#fixturesObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/spectacular_rails/spec_controller.rb', line 10

def fixtures
  format = params[:format]

  p format

  if %w(txt dom).include? format
    path = File.new("#{Rails.root}/#{SpectacularRails.fixture_path}/#{params[:filename]}.#{format}").read
    render text: path
  else
    render "#{SpectacularRails.fixture_path}/#{params[:filename]}", layout: false
  end
end

#indexObject



4
5
6
7
8
# File 'app/controllers/spectacular_rails/spec_controller.rb', line 4

def index
  @spec_options = SpectacularRails.spec_options
  @specsuite = params[:suite].try(:concat, ".spec") || "spec"
  @asset_options = %w(true false).include?(params[:debug]) ? { debug: params[:debug] == 'true' } : {}
end