Sha256: be3abefd08185c52b05e1beb96e1c451e71961fa6f87afec34b1b1740875c837

Contents?: true

Size: 843 Bytes

Versions: 1

Compression:

Stored size: 843 Bytes

Contents

require 'action_controller/railtie'
require 'action_view/railtie'

# config
app = Class.new Rails::Application
app.config.active_support.deprecation = :log
app.config.secret_token = "e65e0140352e39703c113b0ce30335e8"
app.config.generators do |g|
#  g.template_engine :haml
end
app.initialize!

STATUS_CODES = [200, 401, 404, 500]
# routing
app.routes.draw do

  STATUS_CODES.each do |e|
    get "/respond_#{e}" => "raccoon#respond_#{e}", as: "respond_#{e}"
  end

end

# controllers
class ApplicationController < ActionController::Base ; end

class RaccoonController < ApplicationController

  STATUS_CODES.each do |e|
    define_method "respond_#{e}" do
      render status: e, text: e, layout: false
    end
  end

end

# helpers
Object.const_set(:ApplicationHelper, Module.new)

Raccoon.configure do |config|
  config.application = app
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
raccoon-0.0.1 spec/fake_rails.rb