Sha256: b16cb65e8c1005aa0ab6faf71c79b134d8d718d8953a65db5125af72bfc6ad1d

Contents?: true

Size: 633 Bytes

Versions: 5

Compression:

Stored size: 633 Bytes

Contents

require 'spec_helper'

describe AktionTest::Support::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

5 entries across 5 versions & 1 rubygems

Version Path
aktion_test-0.3.1 spec/aktion_test/class_builder_spec.rb
aktion_test-0.3.0 spec/aktion_test/class_builder_spec.rb
aktion_test-0.2.2 spec/aktion_test/class_builder_spec.rb
aktion_test-0.2.1 spec/aktion_test/class_builder_spec.rb
aktion_test-0.2.0 spec/aktion_test/class_builder_spec.rb