summaryrefslogtreecommitdiff
path: root/spec/rubyspec/library/delegate
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-09-20 20:18:52 +0000
commit1d15d5f08032acf1b7bceacbb450d617ff6e0931 (patch)
treea3785a79899302bc149e4a6e72f624ac27dc1f10 /spec/rubyspec/library/delegate
parent75bfc6440d595bf339007f4fb280fd4d743e89c1 (diff)
Move spec/rubyspec to spec/ruby for consistency
* Other ruby implementations use the spec/ruby directory. [Misc #13792] [ruby-core:82287] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/rubyspec/library/delegate')
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/instance_method_spec.rb52
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/instance_methods_spec.rb26
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/private_instance_methods_spec.rb23
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/protected_instance_methods_spec.rb29
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/public_instance_methods_spec.rb25
-rw-r--r--spec/rubyspec/library/delegate/delegate_class/respond_to_missing_spec.rb23
-rw-r--r--spec/rubyspec/library/delegate/delegator/case_compare_spec.rb11
-rw-r--r--spec/rubyspec/library/delegate/delegator/compare_spec.rb11
-rw-r--r--spec/rubyspec/library/delegate/delegator/complement_spec.rb11
-rw-r--r--spec/rubyspec/library/delegate/delegator/eql_spec.rb46
-rw-r--r--spec/rubyspec/library/delegate/delegator/equal_spec.rb13
-rw-r--r--spec/rubyspec/library/delegate/delegator/equal_value_spec.rb24
-rw-r--r--spec/rubyspec/library/delegate/delegator/frozen_spec.rb39
-rw-r--r--spec/rubyspec/library/delegate/delegator/hash_spec.rb11
-rw-r--r--spec/rubyspec/library/delegate/delegator/marshal_spec.rb21
-rw-r--r--spec/rubyspec/library/delegate/delegator/method_spec.rb69
-rw-r--r--spec/rubyspec/library/delegate/delegator/methods_spec.rb37
-rw-r--r--spec/rubyspec/library/delegate/delegator/not_equal_spec.rb24
-rw-r--r--spec/rubyspec/library/delegate/delegator/not_spec.rb11
-rw-r--r--spec/rubyspec/library/delegate/delegator/private_methods_spec.rb20
-rw-r--r--spec/rubyspec/library/delegate/delegator/protected_methods_spec.rb18
-rw-r--r--spec/rubyspec/library/delegate/delegator/public_methods_spec.rb18
-rw-r--r--spec/rubyspec/library/delegate/delegator/send_spec.rb26
-rw-r--r--spec/rubyspec/library/delegate/delegator/taint_spec.rb23
-rw-r--r--spec/rubyspec/library/delegate/delegator/tap_spec.rb16
-rw-r--r--spec/rubyspec/library/delegate/delegator/trust_spec.rb22
-rw-r--r--spec/rubyspec/library/delegate/delegator/untaint_spec.rb24
-rw-r--r--spec/rubyspec/library/delegate/delegator/untrust_spec.rb23
-rw-r--r--spec/rubyspec/library/delegate/fixtures/classes.rb60
29 files changed, 0 insertions, 756 deletions
diff --git a/spec/rubyspec/library/delegate/delegate_class/instance_method_spec.rb b/spec/rubyspec/library/delegate/delegate_class/instance_method_spec.rb
deleted file mode 100644
index 61680b9d5a..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/instance_method_spec.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "DelegateClass.instance_method" do
- before :all do
- @klass = DelegateSpecs::DelegateClass
- @obj = @klass.new(DelegateSpecs::Simple.new)
- end
-
- it "returns a method object for public instance methods of the delegated class" do
- m = @klass.instance_method(:pub)
- m.should be_an_instance_of(UnboundMethod)
- m.bind(@obj).call.should == :foo
- end
-
- it "returns a method object for protected instance methods of the delegated class" do
- m = @klass.instance_method(:prot)
- m.should be_an_instance_of(UnboundMethod)
- m.bind(@obj).call.should == :protected
- end
-
- it "raises a NameError for a private instance methods of the delegated class" do
- lambda {
- @klass.instance_method(:priv)
- }.should raise_error(NameError)
- end
-
- it "returns a method object for public instance methods of the DelegateClass class" do
- m = @klass.instance_method(:extra)
- m.should be_an_instance_of(UnboundMethod)
- m.bind(@obj).call.should == :cheese
- end
-
- it "returns a method object for protected instance methods of the DelegateClass class" do
- m = @klass.instance_method(:extra_protected)
- m.should be_an_instance_of(UnboundMethod)
- m.bind(@obj).call.should == :baz
- end
-
- it "returns a method object for private instance methods of the DelegateClass class" do
- m = @klass.instance_method(:extra_private)
- m.should be_an_instance_of(UnboundMethod)
- m.bind(@obj).call.should == :bar
- end
-
- it "raises a NameError for an invalid method name" do
- lambda {
- @klass.instance_method(:invalid_and_silly_method_name)
- }.should raise_error(NameError)
- end
-
-end
diff --git a/spec/rubyspec/library/delegate/delegate_class/instance_methods_spec.rb b/spec/rubyspec/library/delegate/delegate_class/instance_methods_spec.rb
deleted file mode 100644
index ae329ab8eb..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/instance_methods_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "DelegateClass.instance_methods" do
- before :all do
- @methods = DelegateSpecs::DelegateClass.instance_methods
- end
-
- it "includes all public methods of the delegated class" do
- @methods.should include :pub
- end
-
- it "includes all protected methods of the delegated class" do
- @methods.should include :prot
- end
-
- it "includes instance methods of the DelegateClass class" do
- @methods.should include :extra
- @methods.should include :extra_protected
- end
-
- it "does not include private methods" do
- @methods.should_not include :priv
- @methods.should_not include :extra_private
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegate_class/private_instance_methods_spec.rb b/spec/rubyspec/library/delegate/delegate_class/private_instance_methods_spec.rb
deleted file mode 100644
index d93b6d0e3d..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/private_instance_methods_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "DelegateClass.private_instance_methods" do
- before :all do
- @methods = DelegateSpecs::DelegateClass.private_instance_methods
- end
-
- it "does not include any instance methods of the delegated class" do
- @methods.should_not include :pub
- @methods.should_not include :prot
- @methods.should_not include :priv # since these are not forwarded...
- end
-
- it "includes private instance methods of the DelegateClass class" do
- @methods.should include :extra_private
- end
-
- it "does not include public or protected instance methods of the DelegateClass class" do
- @methods.should_not include :extra
- @methods.should_not include :extra_protected
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegate_class/protected_instance_methods_spec.rb b/spec/rubyspec/library/delegate/delegate_class/protected_instance_methods_spec.rb
deleted file mode 100644
index 3ae0270dbd..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/protected_instance_methods_spec.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "DelegateClass.protected_instance_methods" do
- before :all do
- @methods = DelegateSpecs::DelegateClass.protected_instance_methods
- end
-
- it "does not include public methods of the delegated class" do
- @methods.should_not include :pub
- end
-
- it "includes the protected methods of the delegated class" do
- @methods.should include :prot
- end
-
- it "includes protected instance methods of the DelegateClass class" do
- @methods.should include :extra_protected
- end
-
- it "does not include public instance methods of the DelegateClass class" do
- @methods.should_not include :extra
- end
-
- it "does not include private methods" do
- @methods.should_not include :priv
- @methods.should_not include :extra_private
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegate_class/public_instance_methods_spec.rb b/spec/rubyspec/library/delegate/delegate_class/public_instance_methods_spec.rb
deleted file mode 100644
index e06b55612e..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/public_instance_methods_spec.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "DelegateClass.public_instance_methods" do
- before :all do
- @methods = DelegateSpecs::DelegateClass.public_instance_methods
- end
-
- it "includes all public methods of the delegated class" do
- @methods.should include :pub
- end
-
- it "does not include the protected methods of the delegated class" do
- @methods.should_not include :prot
- end
-
- it "includes public instance methods of the DelegateClass class" do
- @methods.should include :extra
- end
-
- it "does not include private methods" do
- @methods.should_not include :priv
- @methods.should_not include :extra_private
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegate_class/respond_to_missing_spec.rb b/spec/rubyspec/library/delegate/delegate_class/respond_to_missing_spec.rb
deleted file mode 100644
index 729cfc96c6..0000000000
--- a/spec/rubyspec/library/delegate/delegate_class/respond_to_missing_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'delegate'
-
-describe "DelegateClass#respond_to_missing?" do
- it "is used for respond_to? behavior of late-bound delegated methods" do
- # From jruby/jruby#3151:
- # DelegateClass subtracts Delegate's public API from the target class's instance_methods
- # to determine which methods to eagerly delegate. If respond_to_missing? shows up in
- # instance_methods, it will get delegated and skip the delegate-aware implementation
- # in Delegate. Any methods that must be delegated through method_missing, like methods
- # defined after the DelegateClass is created, will fail to dispatch properly.
-
- cls = Class.new
- dcls = DelegateClass(cls)
- cdcls = Class.new(dcls)
- cdcls_obj = cdcls.new(cls.new)
-
- cdcls_obj.respond_to?(:foo).should == false
-
- cls.class_eval { def foo; end }
-
- cdcls_obj.respond_to?(:foo).should == true
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/case_compare_spec.rb b/spec/rubyspec/library/delegate/delegator/case_compare_spec.rb
deleted file mode 100644
index 8bf79c1425..0000000000
--- a/spec/rubyspec/library/delegate/delegator/case_compare_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#===" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:===).with(42).and_return(:foo)
- (delegator === 42).should == :foo
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/compare_spec.rb b/spec/rubyspec/library/delegate/delegator/compare_spec.rb
deleted file mode 100644
index 93431bfeb2..0000000000
--- a/spec/rubyspec/library/delegate/delegator/compare_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#<=>" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:<=>).with(42).and_return(1)
- (delegator <=> 42).should == 1
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/complement_spec.rb b/spec/rubyspec/library/delegate/delegator/complement_spec.rb
deleted file mode 100644
index 877a6e99c6..0000000000
--- a/spec/rubyspec/library/delegate/delegator/complement_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#~" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:~).and_return(:foo)
- (~delegator).should == :foo
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/eql_spec.rb b/spec/rubyspec/library/delegate/delegator/eql_spec.rb
deleted file mode 100644
index fd6824ec55..0000000000
--- a/spec/rubyspec/library/delegate/delegator/eql_spec.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#eql?" do
- ruby_version_is ""..."2.5" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:eql?).with(42).and_return(:foo)
- delegator.eql?(42).should == :foo
- end
- end
-
- ruby_version_is "2.5" do
- it "returns true when compared with same delegator" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
-
- delegator.eql?(delegator).should be_true
- end
-
- it "returns true when compared with the inner object" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
-
- delegator.eql?(base).should be_true
- end
-
- it "returns false when compared with the delegator with other object" do
- base = mock('base')
- other = mock('other')
- delegator0 = DelegateSpecs::Delegator.new(base)
- delegator1 = DelegateSpecs::Delegator.new(other)
-
- delegator0.eql?(delegator1).should be_false
- end
-
- it "returns false when compared with the other object" do
- base = mock('base')
- other = mock('other')
- delegator = DelegateSpecs::Delegator.new(base)
-
- delegator.eql?(other).should be_false
- end
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/equal_spec.rb b/spec/rubyspec/library/delegate/delegator/equal_spec.rb
deleted file mode 100644
index 9333d6a303..0000000000
--- a/spec/rubyspec/library/delegate/delegator/equal_spec.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#equal?" do
- it "returns true only when compared with the delegator" do
- obj = mock('base')
- delegator = DelegateSpecs::Delegator.new(obj)
- obj.should_not_receive(:equal?)
- delegator.equal?(obj).should be_false
- delegator.equal?(nil).should be_false
- delegator.equal?(delegator).should be_true
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/equal_value_spec.rb b/spec/rubyspec/library/delegate/delegator/equal_value_spec.rb
deleted file mode 100644
index 7c965d77d3..0000000000
--- a/spec/rubyspec/library/delegate/delegator/equal_value_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#==" do
- before :all do
- @base = mock('base')
- @delegator = DelegateSpecs::Delegator.new(@base)
- end
-
- it "is not delegated when passed self" do
- @base.should_not_receive(:==)
- (@delegator == @delegator).should be_true
- end
-
- it "is delegated when passed the delegated object" do
- @base.should_receive(:==).and_return(false)
- (@delegator == @base).should be_false
- end
-
- it "is delegated in general" do
- @base.should_receive(:==).and_return(true)
- (@delegator == 42).should be_true
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/frozen_spec.rb b/spec/rubyspec/library/delegate/delegator/frozen_spec.rb
deleted file mode 100644
index 1fb561a349..0000000000
--- a/spec/rubyspec/library/delegate/delegator/frozen_spec.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator when frozen" do
- before :all do
- @array = [42, :hello]
- @delegate = DelegateSpecs::Delegator.new(@array)
- @delegate.freeze
- end
-
- it "is still readable" do
- @delegate.should == [42, :hello]
- @delegate.include?("bar").should be_false
- end
-
- it "is frozen" do
- @delegate.frozen?.should be_true
- end
-
- it "is not writeable" do
- lambda{ @delegate[0] += 2 }.should raise_error( RuntimeError )
- end
-
- it "creates a frozen clone" do
- @delegate.clone.frozen?.should be_true
- end
-
- it "creates an unfrozen dup" do
- @delegate.dup.frozen?.should be_false
- end
-
- it "causes mutative calls to raise RuntimeError" do
- lambda{ @delegate.__setobj__("hola!") }.should raise_error( RuntimeError )
- end
-
- it "returns false if only the delegated object is frozen" do
- DelegateSpecs::Delegator.new([1,2,3].freeze).frozen?.should be_false
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/hash_spec.rb b/spec/rubyspec/library/delegate/delegator/hash_spec.rb
deleted file mode 100644
index 3719d1b249..0000000000
--- a/spec/rubyspec/library/delegate/delegator/hash_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#hash" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:hash).and_return(42)
- delegator.hash.should == 42
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/marshal_spec.rb b/spec/rubyspec/library/delegate/delegator/marshal_spec.rb
deleted file mode 100644
index 5af32b5754..0000000000
--- a/spec/rubyspec/library/delegate/delegator/marshal_spec.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require 'delegate'
-
-describe "SimpleDelegator" do
- before :all do
- @obj = "hello"
- @delegate = SimpleDelegator.new(@obj)
- end
-
- it "can be marshalled" do
- m = Marshal.load(Marshal.dump(@delegate))
- m.class.should == SimpleDelegator
- (m == @obj).should be_true
- end
-
- it "can be marshalled with its instance variables intact" do
- @delegate.instance_variable_set(:@foo, "bar")
- m = Marshal.load(Marshal.dump(@delegate))
- m.instance_variable_get(:@foo).should == "bar"
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/method_spec.rb b/spec/rubyspec/library/delegate/delegator/method_spec.rb
deleted file mode 100644
index 1760eda645..0000000000
--- a/spec/rubyspec/library/delegate/delegator/method_spec.rb
+++ /dev/null
@@ -1,69 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#method" do
- before :each do
- @simple = DelegateSpecs::Simple.new
- @delegate = DelegateSpecs::Delegator.new(@simple)
- end
-
- it "returns a method object for public methods of the delegate object" do
- m = @delegate.method(:pub)
- m.should be_an_instance_of(Method)
- m.call.should == :foo
- end
-
- it "raises a NameError for protected methods of the delegate object" do
- lambda {
- -> {
- @delegate.method(:prot)
- }.should complain(/delegator does not forward private method #prot/)
- }.should raise_error(NameError)
- end
-
- it "raises a NameError for a private methods of the delegate object" do
- lambda {
- -> {
- @delegate.method(:priv)
- }.should complain(/delegator does not forward private method #priv/)
- }.should raise_error(NameError)
- end
-
- it "returns a method object for public methods of the Delegator class" do
- m = @delegate.method(:extra)
- m.should be_an_instance_of(Method)
- m.call.should == :cheese
- end
-
- it "returns a method object for protected methods of the Delegator class" do
- m = @delegate.method(:extra_protected)
- m.should be_an_instance_of(Method)
- m.call.should == :baz
- end
-
- it "returns a method object for private methods of the Delegator class" do
- m = @delegate.method(:extra_private)
- m.should be_an_instance_of(Method)
- m.call.should == :bar
- end
-
- it "raises a NameError for an invalid method name" do
- lambda {
- @delegate.method(:invalid_and_silly_method_name)
- }.should raise_error(NameError)
- end
-
- it "returns a method that respond_to_missing?" do
- m = @delegate.method(:pub_too)
- m.should be_an_instance_of(Method)
- m.call.should == :pub_too
- end
-
- it "raises a NameError if method is no longer valid because object has changed" do
- m = @delegate.method(:pub)
- @delegate.__setobj__([1,2,3])
- lambda {
- m.call
- }.should raise_error(NameError)
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/methods_spec.rb b/spec/rubyspec/library/delegate/delegator/methods_spec.rb
deleted file mode 100644
index 91a6d68bfa..0000000000
--- a/spec/rubyspec/library/delegate/delegator/methods_spec.rb
+++ /dev/null
@@ -1,37 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#methods" do
- before :all do
- @simple = DelegateSpecs::Simple.new
- class << @simple
- def singleton_method
- end
- end
-
- @delegate = DelegateSpecs::Delegator.new(@simple)
- @methods = @delegate.methods
- end
-
- it "returns singleton methods when passed false" do
- @delegate.methods(false).should include(:singleton_method)
- end
-
- it "includes all public methods of the delegate object" do
- @methods.should include :pub
- end
-
- it "includes all protected methods of the delegate object" do
- @methods.should include :prot
- end
-
- it "includes instance methods of the Delegator class" do
- @methods.should include :extra
- @methods.should include :extra_protected
- end
-
- it "does not include private methods" do
- @methods.should_not include :priv
- @methods.should_not include :extra_private
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/not_equal_spec.rb b/spec/rubyspec/library/delegate/delegator/not_equal_spec.rb
deleted file mode 100644
index c2f91dcfa1..0000000000
--- a/spec/rubyspec/library/delegate/delegator/not_equal_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#!=" do
- before :all do
- @base = mock('base')
- @delegator = DelegateSpecs::Delegator.new(@base)
- end
-
- it "is not delegated when passed self" do
- @base.should_not_receive(:"!=")
- (@delegator != @delegator).should be_false
- end
-
- it "is delegated when passed the delegated object" do
- @base.should_receive(:"!=").and_return(true)
- (@delegator != @base).should be_true
- end
-
- it "is delegated in general" do
- @base.should_receive(:"!=").and_return(false)
- (@delegator != 42).should be_false
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/not_spec.rb b/spec/rubyspec/library/delegate/delegator/not_spec.rb
deleted file mode 100644
index 678e07e418..0000000000
--- a/spec/rubyspec/library/delegate/delegator/not_spec.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#!" do
- it "is delegated" do
- base = mock('base')
- delegator = DelegateSpecs::Delegator.new(base)
- base.should_receive(:"!").and_return(:foo)
- (!delegator).should == :foo
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/private_methods_spec.rb b/spec/rubyspec/library/delegate/delegator/private_methods_spec.rb
deleted file mode 100644
index 557da9bd02..0000000000
--- a/spec/rubyspec/library/delegate/delegator/private_methods_spec.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#private_methods" do
- before :all do
- @simple = DelegateSpecs::Simple.new
- @delegate = DelegateSpecs::Delegator.new(@simple)
- @methods = @delegate.private_methods
- end
-
- it "does not include any method of the delegate object" do # since delegates does not forward private calls
- @methods.should_not include :priv
- @methods.should_not include :prot
- @methods.should_not include :pub
- end
-
- it "includes all private instance methods of the Delegate class" do
- @methods.should include :extra_private
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/protected_methods_spec.rb b/spec/rubyspec/library/delegate/delegator/protected_methods_spec.rb
deleted file mode 100644
index 5f03575f25..0000000000
--- a/spec/rubyspec/library/delegate/delegator/protected_methods_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#protected_methods" do
- before :all do
- @simple = DelegateSpecs::Simple.new
- @delegate = DelegateSpecs::Delegator.new(@simple)
- @methods = @delegate.protected_methods
- end
-
- it "includes protected methods of the delegate object" do
- @methods.should include :prot
- end
-
- it "includes protected instance methods of the Delegator class" do
- @methods.should include :extra_protected
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/public_methods_spec.rb b/spec/rubyspec/library/delegate/delegator/public_methods_spec.rb
deleted file mode 100644
index 4ed626be33..0000000000
--- a/spec/rubyspec/library/delegate/delegator/public_methods_spec.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#public_methods" do
- before :all do
- @simple = DelegateSpecs::Simple.new
- @delegate = DelegateSpecs::Delegator.new(@simple)
- @methods = @delegate.public_methods
- end
-
- it "includes public methods of the delegate object" do
- @methods.should include :pub
- end
-
- it "includes public instance methods of the Delegator class" do
- @methods.should include :extra
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/send_spec.rb b/spec/rubyspec/library/delegate/delegator/send_spec.rb
deleted file mode 100644
index b6e66cb74a..0000000000
--- a/spec/rubyspec/library/delegate/delegator/send_spec.rb
+++ /dev/null
@@ -1,26 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "SimpleDelegator.new" do
- before :all do
- @simple = DelegateSpecs::Simple.new
- @delegate = SimpleDelegator.new(@simple)
- end
-
- it "forwards public method calls" do
- @delegate.pub.should == :foo
- end
-
- it "forwards protected method calls" do
- lambda{ @delegate.prot }.should raise_error( NoMethodError )
- end
-
- it "doesn't forward private method calls" do
- lambda{ @delegate.priv }.should raise_error( NoMethodError )
- end
-
- it "doesn't forward private method calls even via send or __send__" do
- lambda{ @delegate.send(:priv, 42) }.should raise_error( NoMethodError )
- lambda{ @delegate.__send__(:priv, 42) }.should raise_error( NoMethodError )
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/taint_spec.rb b/spec/rubyspec/library/delegate/delegator/taint_spec.rb
deleted file mode 100644
index f78446d018..0000000000
--- a/spec/rubyspec/library/delegate/delegator/taint_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#taint" do
- before :each do
- @delegate = DelegateSpecs::Delegator.new("")
- end
-
- it "returns self" do
- @delegate.taint.equal?(@delegate).should be_true
- end
-
- it "taints the delegator" do
- @delegate.__setobj__(nil)
- @delegate.taint
- @delegate.tainted?.should be_true
- end
-
- it "taints the delegated object" do
- @delegate.taint
- @delegate.__getobj__.tainted?.should be_true
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/tap_spec.rb b/spec/rubyspec/library/delegate/delegator/tap_spec.rb
deleted file mode 100644
index 1da6d82b01..0000000000
--- a/spec/rubyspec/library/delegate/delegator/tap_spec.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#tap" do
- it "yield the delegator object" do
- obj = mock('base')
- delegator = DelegateSpecs::Delegator.new(obj)
- obj.should_not_receive(:tap)
- yielded = []
- delegator.tap do |x|
- yielded << x
- end
- yielded.size.should == 1
- yielded[0].equal?(delegator).should be_true
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/trust_spec.rb b/spec/rubyspec/library/delegate/delegator/trust_spec.rb
deleted file mode 100644
index 182395c26e..0000000000
--- a/spec/rubyspec/library/delegate/delegator/trust_spec.rb
+++ /dev/null
@@ -1,22 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#trust" do
- before :each do
- @delegate = DelegateSpecs::Delegator.new([])
- end
-
- it "returns self" do
- @delegate.trust.equal?(@delegate).should be_true
- end
-
- it "trusts the delegator" do
- @delegate.trust
- @delegate.untrusted?.should be_false
- end
-
- it "trusts the delegated object" do
- @delegate.trust
- @delegate.__getobj__.untrusted?.should be_false
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/untaint_spec.rb b/spec/rubyspec/library/delegate/delegator/untaint_spec.rb
deleted file mode 100644
index 2cce99e206..0000000000
--- a/spec/rubyspec/library/delegate/delegator/untaint_spec.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#untaint" do
- before :each do
- @delegate = lambda { DelegateSpecs::Delegator.new("") }.call
- end
-
- it "returns self" do
- @delegate.untaint.equal?(@delegate).should be_true
- end
-
- it "untaints the delegator" do
- @delegate.untaint
- @delegate.tainted?.should be_false
- # No additional meaningful test; that it does or not taint
- # "for real" the delegator has no consequence
- end
-
- it "untaints the delegated object" do
- @delegate.untaint
- @delegate.__getobj__.tainted?.should be_false
- end
-end
diff --git a/spec/rubyspec/library/delegate/delegator/untrust_spec.rb b/spec/rubyspec/library/delegate/delegator/untrust_spec.rb
deleted file mode 100644
index e2bbf1b294..0000000000
--- a/spec/rubyspec/library/delegate/delegator/untrust_spec.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-require File.expand_path('../../../../spec_helper', __FILE__)
-require File.expand_path('../../fixtures/classes', __FILE__)
-
-describe "Delegator#untrust" do
- before :each do
- @delegate = DelegateSpecs::Delegator.new("")
- end
-
- it "returns self" do
- @delegate.untrust.equal?(@delegate).should be_true
- end
-
- it "untrusts the delegator" do
- @delegate.__setobj__(nil)
- @delegate.untrust
- @delegate.untrusted?.should be_true
- end
-
- it "untrusts the delegated object" do
- @delegate.untrust
- @delegate.__getobj__.untrusted?.should be_true
- end
-end
diff --git a/spec/rubyspec/library/delegate/fixtures/classes.rb b/spec/rubyspec/library/delegate/fixtures/classes.rb
deleted file mode 100644
index 3cb43eb8b1..0000000000
--- a/spec/rubyspec/library/delegate/fixtures/classes.rb
+++ /dev/null
@@ -1,60 +0,0 @@
-require 'delegate'
-module DelegateSpecs
- class Simple
- def pub
- :foo
- end
-
- def respond_to_missing?(method, priv=false)
- method == :pub_too ||
- (priv && method == :priv_too)
- end
-
- def method_missing(method, *args)
- super unless respond_to_missing?(method, true)
- method
- end
-
- def priv(arg=nil)
- yield arg if block_given?
- [:priv, arg]
- end
- private :priv
-
- def prot
- :protected
- end
- protected :prot
- end
-
- module Extra
- def extra
- :cheese
- end
-
- def extra_private
- :bar
- end
- private :extra_private
-
- def extra_protected
- :baz
- end
- protected :extra_protected
- end
-
- class Delegator < ::Delegator
- attr_accessor :data
-
- attr_reader :__getobj__
- def __setobj__(o)
- @__getobj__ = o
- end
-
- include Extra
- end
-
- class DelegateClass < DelegateClass(Simple)
- include Extra
- end
-end