Sha256: b6572b09ec13c70ec7db9281509fb4c4c623786aacf0c5716ac93044a4d5ffc2

Contents?: true

Size: 646 Bytes

Versions: 2

Compression:

Stored size: 646 Bytes

Contents

require 'spec_helper'
require 'windcharger/hash_transformer'

describe Windcharger::HashTransformer do
  describe "#transform" do
    it "returns a hash with attribute names and return values from those methods" do
      transformer_class = Class.new do
        extend Windcharger::Attributes
        include Windcharger::HashTransformer

        attribute
        def foo; 42; end
        attribute
        def bar; 'colorless green ideas'; end
        def baz; end
      end
      transformer = transformer_class.new

      expect(transformer.transform).to eq({
        foo: 42,
        bar: 'colorless green ideas',
      })
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
windcharger-0.2.0 spec/windcharger/hash_transformer_spec.rb
windcharger-0.1.0 spec/windcharger/hash_transformer_spec.rb