Sha256: d8fb4df54c38657e1dd2636f6796f13a1ba79b1f9f12e827bb8c29630559fcac

Contents?: true

Size: 913 Bytes

Versions: 55

Compression:

Stored size: 913 Bytes

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

require 'spec_helper'
require 'cosmos/core_ext/class'

describe Class do

  describe "instance_attr_reader" do
    it "adds instance attribute readers for class variables" do
      class MyClass
        instance_attr_reader :test
        @@instance = nil
        def self.instance
          @@instance ||= self.new
          return @@instance
        end
        def initialize
          @test = "Test"
          @@instance = self
        end
      end

      my = MyClass.new
      expect(MyClass.test).to eql "Test"
      expect(my.test).to eql "Test"
    end
  end
end

Version data entries

55 entries across 55 versions & 1 rubygems

Version Path
cosmos-4.5.0-java spec/core_ext/class_spec.rb
cosmos-4.5.0 spec/core_ext/class_spec.rb
cosmos-4.4.2-java spec/core_ext/class_spec.rb
cosmos-4.4.2 spec/core_ext/class_spec.rb
cosmos-4.4.1-java spec/core_ext/class_spec.rb
cosmos-4.4.1 spec/core_ext/class_spec.rb
cosmos-4.4.0-java spec/core_ext/class_spec.rb
cosmos-4.4.0 spec/core_ext/class_spec.rb
cosmos-4.3.0-java spec/core_ext/class_spec.rb
cosmos-4.3.0 spec/core_ext/class_spec.rb
cosmos-4.2.4-java spec/core_ext/class_spec.rb
cosmos-4.2.4 spec/core_ext/class_spec.rb
cosmos-4.2.3-java spec/core_ext/class_spec.rb
cosmos-4.2.3 spec/core_ext/class_spec.rb
cosmos-4.2.2-java spec/core_ext/class_spec.rb
cosmos-4.2.2 spec/core_ext/class_spec.rb
cosmos-4.2.1-java spec/core_ext/class_spec.rb
cosmos-4.2.1 spec/core_ext/class_spec.rb
cosmos-4.2.0-java spec/core_ext/class_spec.rb
cosmos-4.2.0 spec/core_ext/class_spec.rb