Class: Teaspoon::SuiteController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/teaspoon/suite_controller.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.before(*args) ⇒ Object



2
3
4
# File 'app/controllers/teaspoon/suite_controller.rb', line 2

def self.before(*args)
  respond_to?(:before_action) ? before_action(*args) : before_filter(*args)
end

Instance Method Details

#fixturesObject



30
31
32
# File 'app/controllers/teaspoon/suite_controller.rb', line 30

def fixtures
  render template: "/#{params[:filename]}"
end

#hookObject



19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/teaspoon/suite_controller.rb', line 19

def hook
  hooks = Teaspoon::Suite.new(params).hooks[params[:hook].to_s]

  if hooks.present?
    hooks.each { |hook| hook.call(hook_params(params[:args])) }
    head(:ok)
  else
    render status: :not_found, json: { err: "The `#{params[:hook]}` hook is not defined in the `#{params[:suite]}` suite " }
  end
end

#indexObject



11
12
13
# File 'app/controllers/teaspoon/suite_controller.rb', line 11

def index
  @suites = Teaspoon::Suite.all
end

#showObject



15
16
17
# File 'app/controllers/teaspoon/suite_controller.rb', line 15

def show
  @suite = Teaspoon::Suite.new(params)
end