Closed maedi closed 2 years ago
Sure:
module Alter
alias_method :alter, :allow
end
RSpec.configure do |c|
c.include Alter
end
We keep GitHub issues for bugs and feature requests. Please consider using our mailing list (https://rspec.info/help/) and resources like StackOverflow. Thanks for understanding.
You shouldn't think of allow
as altering. It does that underneath, but for the person reading the specs (yes, it is "specs", not "tests"), allow(user).to receive(:name).and_return('Bob')
should sound exactly as it reads. With "alter" it doesn't read right.
I've been using allow
a bit more and realised why it bugs me. It's because the word "allow" implies that the method will now do a new thing, but it will also continue doing the old thing too. But RSpec uses "allow" to limit/change/alter behaviour to just do the new thing. I still think it's just the wrong word for this. I don't follow the "alter doesn't read right" logic, can you give me more reasoning?
(I think this was just a template sentence, but RE "We keep GitHub issues for bugs and feature requests.".... this is a feature request)
(I think this was just a template sentence, but RE "We keep GitHub issues for bugs and feature requests.".... this is a feature request)
There was no concrete feature requested that could not be satisfied with plain Ruby (as Pirj demonstrated) and a philosophical debate about the meaning of words is best suited for the mailing list.
I found
allow
hard to understand at first. Could an alias bealter
?