Sha256: 0726deb6ed83a754c36d236cc15308cbc825835cdce7c164b8abf25b84cd2125

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

require 'spec_helper'
require 'ruby-debug'

describe "module_extensions" do
  describe "my_extension" do
    it "should allow a method to be added to a class when the method does not already exists" do
      class A
        my_extension("foo") do
          def foo
            'foo'
          end
        end
      end
      A.instance_methods.include?('foo').should be_true
    end

    it "should not allow adding a method to a class if the method already exists" do
      class A
        def foo
          'bar'
        end
      end

      class A
        my_extension("foo") do
          def foo
            'foo'
          end
        end
      end
      a = A.new
      a.foo.should == 'bar'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
royw-roys_extensions-0.0.4 spec/module_extensions_spec.rb