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.1.1-java spec/core_ext/class_spec.rb
cosmos-4.1.1 spec/core_ext/class_spec.rb
cosmos-4.1.0-java spec/core_ext/class_spec.rb
cosmos-4.1.0 spec/core_ext/class_spec.rb
cosmos-4.0.3-java spec/core_ext/class_spec.rb
cosmos-4.0.3-universal-java-1.8 spec/core_ext/class_spec.rb
cosmos-4.0.3 spec/core_ext/class_spec.rb
cosmos-4.0.2-universal-java-1.8 spec/core_ext/class_spec.rb
cosmos-4.0.2 spec/core_ext/class_spec.rb
cosmos-4.0.1-universal-java-1.8 spec/core_ext/class_spec.rb
cosmos-4.0.1 spec/core_ext/class_spec.rb
cosmos-4.0.0-universal-java-1.8 spec/core_ext/class_spec.rb
cosmos-4.0.0 spec/core_ext/class_spec.rb
cosmos-3.9.2 spec/core_ext/class_spec.rb
cosmos-3.9.1 spec/core_ext/class_spec.rb
cosmos-3.8.3 spec/core_ext/class_spec.rb
cosmos-3.8.2 spec/core_ext/class_spec.rb
cosmos-3.8.1 spec/core_ext/class_spec.rb
cosmos-3.8.0 spec/core_ext/class_spec.rb
cosmos-3.7.1 spec/core_ext/class_spec.rb