Skip to content

Instantly share code, notes, and snippets.

View delegate_matcher.rb
# RSpec matcher to spec delegations.
# Forked from https://gist.github.com/joeytheman/0fe021821e4c62f552ce
# to add delegation to child class within delegator namespace
#
# 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) }