Sha256: 401a7fcd1700bd45619e5affed1ceda54b583ce27c6dd82be225ad56b005b428

Contents?: true

Size: 461 Bytes

Versions: 1

Compression:

Stored size: 461 Bytes

Contents

#
# Method alias matcher.
#
#   describe User do
#     it { is_expected.to alias_method(:admin?, :is_admin) }
#   end
#
# Originally from: https://gist.github.com/1950961, but heavily reworked consistency-wise.
#

RSpec::Matchers.define :alias_method do |new_name, old_name|
  match do |subject|
    expect(subject.method(new_name)).to eq subject.method(old_name)
  end

  description do
    "have #{new_name.inspect} aliased to #{old_name.inspect}"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails_dt-1.2.0 spec/support/alias_method_matcher.rb