Sha256: c69d5e463c836e8d8b760503ad8ee942f4c21e8cd38782e3efaa2fc84e03fd6b

Contents?: true

Size: 1.46 KB

Versions: 29

Compression:

Stored size: 1.46 KB

Contents

require 'test_helper'

class ArrayTest < Test::Unit::TestCase
  
  context "Method" do
    setup do
      @cat = "cat"
      @bound = @cat.method(:upcase) 
    end
    
    context "#name" do
      should "conform to doc" do
        assert_equal "upcase", @bound.name
      end
    end
  
    context "#owner" do
      should "conform to doc" do
        assert_equal String, @bound.owner
      end
    end
  
    context "#receiver" do
      should "conform to doc" do
        assert @cat === @bound.receiver
      end
    end
  
    context "Unbound" do
      setup do
        @unbound = @bound.unbind
      end
      
      context "#name" do
        should "conform to doc" do
          assert_equal "upcase", @unbound.name
        end
      end
  
      context "#owner" do
        should "conform to doc" do
          assert_equal String, @unbound.owner
        end
      end
      
      context "bound again" do
        setup do
          @dog = "dog"
          @bound_again = @unbound.bind(@dog)
        end
        
        context "#name" do
          should "conform to doc" do
            assert_equal "upcase", @bound_again.name
          end
        end
  
        context "#owner" do
          should "conform to doc" do
            assert_equal String, @bound_again.owner
          end
        end
  
        context "#receiver" do
          should "conform to doc" do
            assert @dog === @bound_again.receiver
          end
        end
  
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
backports-1.15.0 test/method_test.rb
backports-1.14.1 test/method_test.rb
backports-1.14.0 test/method_test.rb
backports-1.13.3 test/method_test.rb
backports-1.13.2 test/method_test.rb
backports-1.13.1 test/method_test.rb
backports-1.13.0 test/method_test.rb
backports-1.12.3 test/method_test.rb
backports-1.12.2 test/method_test.rb