Sha256: 92c4a7b92ff304d84d24795e9890553ca816a23d17d4fc336dd67ac65a513878

Contents?: true

Size: 694 Bytes

Versions: 7

Compression:

Stored size: 694 Bytes

Contents

#!/usr/bin/env ruby

require File.expand_path(File.join(File.dirname(__FILE__), "common"))

describe BinData::Base, "when defining" do
  it "fails if #initialize is overridden" do
    class BaseWithInitialize < BinData::Base
      def initialize(params = {}, parent = nil)
        super
      end
    end

    lambda {
      BaseWithInitialize.new
    }.must_raise RuntimeError
  end

  it "handles if #initialize is naively renamed to #initialize_instance" do
    class BaseWithInitializeInstance < BinData::Base
      def initialize_instance(params = {}, parent = nil)
        super
      end
    end

    lambda {
      BaseWithInitializeInstance.new
    }.must_raise RuntimeError
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
bindata-2.1.0 test/warnings_test.rb
bindata-1.8.3 test/deprecated_test.rb
bindata-2.0.0 test/deprecated_test.rb
bindata-1.8.2 test/deprecated_test.rb
bindata-1.8.1 test/deprecated_test.rb
bindata-1.8.0 test/deprecated_test.rb
bindata-1.6.0 test/deprecated_test.rb