RSpec 1.x matcher for delegations

Posted . Visible to the public.

The attached RSpec matcher allows for comfortably testing delegation.

Examples

describe Post do
  it { should delegate(:name).to(:author).with_prefix } # post.author_name
  it { should delegate(:month).to(:created_at) }
  it { should delegate(:year).to(:created_at) }
end

Credits go to txus Show archive.org snapshot . See the attached link for an RSpec 2+ version.

Dominik Schöler
Attachments
License
Source code in this card is licensed under the MIT License.
Posted by Dominik Schöler to makandra dev (2014-07-08 12:58)