This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RSpec matcher to spec delegations. | |
# Forked from https://gist.github.com/ssimeonov/5942729 with fixes | |
# for arity + custom prefix. | |
# | |
# Usage: | |
# | |
# describe Post do | |
# it { should delegate(:name).to(:author).with_prefix } # post.author_name | |
# it { should delegate(:name).to(:author).with_prefix(:any) } # post.any_name | |
# it { should delegate(:month).to(:created_at) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ApplicationController < ActionController::Base | |
TOKEN_PLACEHOLDER = "__CROSS_SITE_REQUEST_FORGERY_PROTECTION_TOKEN__" | |
before_filter :form_authenticity_token | |
after_filter :inject_csrf_token | |
private | |
def inject_csrf_token | |
if protect_against_forgery? && token = session['_csrf_token'] |