Sha256: 294989ee62b668b27d9b1d505eb2a3cb0e2c46d933958638d9b3838cc13ae48f

Contents?: true

Size: 1.08 KB

Versions: 15

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

describe Celluloid::Properties do
  let(:default_value) { 42 }
  let(:changed_value) { 43 }

  let(:example_class) do
    Class.new do
      extend Celluloid::Properties
      property :baz, :default => 42
    end
  end

  let(:example_subclass) do
    Class.new(example_class)
  end

  let(:example_subclass_subclass) do
    Class.new(example_subclass)
  end

  it "adds properties to classes" do
    example_class.baz.should eq default_value
    example_class.baz changed_value
    example_class.baz.should eq changed_value
  end

  it "allows properties to be inherited" do
    example_subclass.baz.should eq default_value
    example_subclass.baz changed_value
    example_subclass.baz.should eq changed_value
    example_class.baz.should eq default_value
  end

  it "allows properties to be deeply inherited" do
    example_subclass_subclass.baz.should eq default_value
    example_subclass_subclass.baz changed_value
    example_subclass_subclass.baz.should eq changed_value
    example_subclass.baz.should eq default_value
    example_class.baz.should eq default_value
  end
end

Version data entries

15 entries across 13 versions & 5 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/celluloid-0.16.0/spec/celluloid/properties_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/celluloid-0.16.0/spec/celluloid/properties_spec.rb
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/celluloid-0.16.0/spec/celluloid/properties_spec.rb
scoot-0.0.4 .bundle/gems/ruby/2.2.0/gems/celluloid-0.16.0/spec/celluloid/properties_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/celluloid-0.16.0/spec/celluloid/properties_spec.rb
celluloid-0.16.0 spec/celluloid/properties_spec.rb
celluloid-0.16.0.pre3 spec/celluloid/properties_spec.rb
vagrant-tiktalik-0.0.3 vendor/bundle/ruby/2.0.0/gems/celluloid-0.15.2/spec/celluloid/properties_spec.rb
celluloid-0.16.0.pre2 spec/celluloid/properties_spec.rb
celluloid-0.16.0.pre spec/celluloid/properties_spec.rb
celluloid-0.15.2 spec/celluloid/properties_spec.rb
celluloid-0.15.1 spec/celluloid/properties_spec.rb
celluloid-0.15.0 spec/celluloid/properties_spec.rb
celluloid-0.15.0.pre2 spec/celluloid/properties_spec.rb
celluloid-0.15.0.pre spec/celluloid/properties_spec.rb