Remove implementation detail specs for Enumerator#1361
Conversation
`Enumerator::Yielder`, `Enumerator::Generator` and `Enumerator::Producer` are not
supposed to be exposed to the user.
Instead they will interact with them trough other means,
like for example `Enumerator.new { |yielder| }`.
Some specs I ported, others I removed, and some were already present.
|
I agree they shouldn't be documented (and merged you ruby/ruby PR) but they are still public API I would say, and based on that I think it's fair enough to test them in ruby/spec. So I wouldn't call the class names implementation details since they are public constants. Is there something specific these specs test you think they shouldn't? From a quick look |
|
In general the philosophy of core specs is "spec every public method of every public class/module" (and also some private methods like |
|
I do like the new specs though, so maybe we'd only remove the useless |
|
I haven't (intentionally) removed any specs: it "returns self" do
y = Enumerator::Yielder.new {|x| x + 1}
(y << 1).should.equal?(y)
end
# into
it 'can be chained' do
enum = Enumerator.new do |y|
y << 1 << 2
end
enum.to_a.should == [1, 2]
endWhich will be how people in theory actually use it. If MRI for some reason decides to return I see this more like ducktyping. The concrete class doesn't matter, as long as it behaves correctly, so I rewrote the specs to how it's actually used. No one is directly instantiating |
Enumerator::Yielder,Enumerator::GeneratorandEnumerator::Producerare not supposed to be exposed to the user.Instead they will interact with them trough other means, like for example
Enumerator.new { |yielder| }.Some specs I ported, others I removed, and some were already present.
I also have this PR to nodoc them ruby/ruby#17036 (they are already basically just present by name only)