diff --git a/core/enumerator/generator/each_spec.rb b/core/enumerator/generator/each_spec.rb deleted file mode 100644 index 41a494298..000000000 --- a/core/enumerator/generator/each_spec.rb +++ /dev/null @@ -1,40 +0,0 @@ -require_relative '../../../spec_helper' - -describe "Enumerator::Generator#each" do - before :each do - @generator = Enumerator::Generator.new do |y, *args| - y << 3 << 2 << 1 - y << args unless args.empty? - :block_returned - end - end - - it "is an enumerable" do - @generator.should.is_a?(Enumerable) - end - - it "supports enumeration with a block" do - r = [] - @generator.each { |v| r << v } - - r.should == [3, 2, 1] - end - - it "raises a LocalJumpError if no block given" do - -> { @generator.each }.should.raise(LocalJumpError) - end - - it "returns the block returned value" do - @generator.each {}.should.equal?(:block_returned) - end - - it "requires multiple arguments" do - Enumerator::Generator.instance_method(:each).arity.should < 0 - end - - it "appends given arguments to receiver.each" do - yields = [] - @generator.each(:each0, :each1) { |yielded| yields << yielded } - yields.should == [3, 2, 1, [:each0, :each1]] - end -end diff --git a/core/enumerator/generator/initialize_spec.rb b/core/enumerator/generator/initialize_spec.rb deleted file mode 100644 index 0f77d591d..000000000 --- a/core/enumerator/generator/initialize_spec.rb +++ /dev/null @@ -1,26 +0,0 @@ -# -*- encoding: us-ascii -*- - -require_relative '../../../spec_helper' - -describe "Enumerator::Generator#initialize" do - before :each do - @class = Enumerator::Generator - @uninitialized = @class.allocate - end - - it "is a private method" do - @class.private_instance_methods(false).should.include?(:initialize) - end - - it "returns self when given a block" do - @uninitialized.send(:initialize) {}.should.equal?(@uninitialized) - end - - describe "on frozen instance" do - it "raises a FrozenError" do - -> { - @uninitialized.freeze.send(:initialize) {} - }.should.raise(FrozenError) - end - end -end diff --git a/core/enumerator/yielder/append_spec.rb b/core/enumerator/yielder/append_spec.rb deleted file mode 100644 index 2e1f5203d..000000000 --- a/core/enumerator/yielder/append_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require_relative '../../../spec_helper' - -describe "Enumerator::Yielder#<<" do - # TODO: There's some common behavior between yield and <<; move to a shared spec - it "yields the value to the block" do - ary = [] - y = Enumerator::Yielder.new {|x| ary << x} - y << 1 - - ary.should == [1] - end - - it "doesn't double-wrap Arrays" do - yields = [] - y = Enumerator::Yielder.new {|args| yields << args } - y << [1] - yields.should == [[1]] - end - - it "returns self" do - y = Enumerator::Yielder.new {|x| x + 1} - (y << 1).should.equal?(y) - end - - context "when multiple arguments passed" do - it "raises an ArgumentError" do - ary = [] - y = Enumerator::Yielder.new { |*x| ary << x } - - -> { - y.<<(1, 2) - }.should.raise(ArgumentError, /wrong number of arguments/) - end - end -end diff --git a/core/enumerator/yielder/initialize_spec.rb b/core/enumerator/yielder/initialize_spec.rb deleted file mode 100644 index 925f561ec..000000000 --- a/core/enumerator/yielder/initialize_spec.rb +++ /dev/null @@ -1,18 +0,0 @@ -# -*- encoding: us-ascii -*- - -require_relative '../../../spec_helper' - -describe "Enumerator::Yielder#initialize" do - before :each do - @class = Enumerator::Yielder - @uninitialized = @class.allocate - end - - it "is a private method" do - @class.private_instance_methods(false).should.include?(:initialize) - end - - it "returns self when given a block" do - @uninitialized.send(:initialize) {}.should.equal?(@uninitialized) - end -end diff --git a/core/enumerator/yielder/to_proc_spec.rb b/core/enumerator/yielder/to_proc_spec.rb deleted file mode 100644 index 1d3681ab5..000000000 --- a/core/enumerator/yielder/to_proc_spec.rb +++ /dev/null @@ -1,16 +0,0 @@ -require_relative '../../../spec_helper' - -describe "Enumerator::Yielder#to_proc" do - it "returns a Proc object that takes an argument and yields it to the block" do - ScratchPad.record [] - y = Enumerator::Yielder.new { |*args| ScratchPad << args; "foobar" } - - callable = y.to_proc - callable.class.should == Proc - - result = callable.call(1, 2) - ScratchPad.recorded.should == [[1, 2]] - - result.should == "foobar" - end -end diff --git a/core/enumerator/yielder/yield_spec.rb b/core/enumerator/yielder/yield_spec.rb deleted file mode 100644 index acfdf114b..000000000 --- a/core/enumerator/yielder/yield_spec.rb +++ /dev/null @@ -1,33 +0,0 @@ -require_relative '../../../spec_helper' - -describe "Enumerator::Yielder#yield" do - it "yields the value to the block" do - ary = [] - y = Enumerator::Yielder.new {|x| ary << x} - y.yield 1 - - ary.should == [1] - end - - it "yields with passed arguments" do - yields = [] - y = Enumerator::Yielder.new {|*args| yields << args } - y.yield 1, 2 - yields.should == [[1, 2]] - end - - it "returns the result of the block for the given value" do - y = Enumerator::Yielder.new {|x| x + 1} - y.yield(1).should == 2 - end - - context "when multiple arguments passed" do - it "yields the arguments list to the block" do - ary = [] - y = Enumerator::Yielder.new { |*x| ary << x } - y.yield(1, 2) - - ary.should == [[1, 2]] - end - end -end