Sha256: 80807dc0fed8b0a2a124a425435040d02d45fd578ce4b801feaada3d5540273c

Contents?: true

Size: 691 Bytes

Versions: 29

Compression:

Stored size: 691 Bytes

Contents

require "spec_helper"

describe Myfinance::Entities::Base do

  class DummyEntity < Myfinance::Entities::Base
    attribute :property_1, String
    attribute :property_2, String
  end

  let(:hash) { { property_1: 1, property_2: 2 } }
  subject    { DummyEntity.new(hash) }

  it "builds an object from a hash" do
    expect(subject).to respond_to(:property_1)
    expect(subject).to respond_to(:property_2)
    expect(subject.property_1).to eq("1")
    expect(subject.property_2).to eq("2")
  end

  describe "#attributes" do
    it "returns a hash from object attributes" do
      expect(subject.to_hash).to eq({
        property_1: "1",
        property_2: "2"
      })
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
myfinance-1.8.2 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.8.1 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.8.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.7.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.6 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.5 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.4 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.3 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.1 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.6.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.5.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.4.1 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.4.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.3.1 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.3.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.2.1 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.2.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.1.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-1.0.0 spec/lib/myfinance/entities/base_spec.rb
myfinance-0.7.0 spec/lib/myfinance/entities/base_spec.rb