class Raccoon::Controller
Attributes
routes[R]
Public Class Methods
case(&block)
click to toggle source
# File lib/raccoon/controller.rb, line 33 def case &block new(&block).routes.each do |router| describe router.controller_class, type: :controller do render_views if ::Raccoon.config.render_views before do router.before.call end context "when requests #{router.method.to_s.upcase} #{router.controller}##{router.action}" do let(:params) { router.params.call } # Check HTTP Response Code it "should be #{Rack::Utils::HTTP_STATUS_CODES[router.response_code]}" do send(router.method, router.action, params) expect(response.response_code).to eq(router.response_code) end end after do router.after.call end end end end
new(&proc)
click to toggle source
# File lib/raccoon/controller.rb, line 7 def initialize &proc instance_eval &proc end
Public Instance Methods
add(router = nil, &block)
click to toggle source
# File lib/raccoon/controller.rb, line 11 def add router = nil, &block @routes ||= [] @routes << router if router @routes << Router.new(&block) if block_given? end