Sha256: edf9b2331e07b50b0175e9e964a9544539a92058a2a3bb325b31a78eb9bf166e

Contents?: true

Size: 624 Bytes

Versions: 2

Compression:

Stored size: 624 Bytes

Contents

require 'spec_helper'

describe AktionTest::ClassBuilder do
  it "creates a new class" do
    clazz = define_class('Foo')
    clazz.new.should be_a Foo
  end

  it "creates a new class with a base" do
    base = define_class('Foo')
    clazz = define_class('Bar', Foo)
    clazz.superclass.should == Foo
  end

  it "creates a new class and class evals a block" do
    clazz = define_class('Foo') do
      class << self
        def foo
          "baz"
        end
      end

      attr_accessor :bar
    end

    clazz.foo.should == 'baz'
    clazz.new.should respond_to :bar
    clazz.new.should respond_to :bar=
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aktion_test-0.1.2 spec/aktion_test/class_builder_spec.rb
aktion_test-0.1.1 spec/aktion_test/class_builder_spec.rb