Sha256: ee0ef5e93d6adc811a9ed802a8353f5f4564895f39797696e6bf76e37e6dde0a

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

require_relative '../lib/kattr'

describe Class do
  before do
    class Dog
      cattr_reader :teeth
      cattr_writer :eye_color
      cattr_accessor :hair_color

      def self.teeth
        "sharp"
      end

      def self.eye_color
        @@eye_color
      end
    end
  end

  it 'cattr_reader' do
    Dog.teeth.should eq("sharp")
  end

  it 'cattr_writer' do
    Dog.eye_color = "green"
    Dog.eye_color.should eq("green")
  end

  it 'cattr_accessor' do
    Dog.hair_color = 'grey'
    Dog.hair_color.should eq("grey")
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kattr-0.0.1 spec/kattr_spec.rb