Sha256: 0dbf3466ce54b013efd8fd73b9437851a4ef5728f0e4194ca4aa1e3979f895d3

Contents?: true

Size: 683 Bytes

Versions: 3

Compression:

Stored size: 683 Bytes

Contents

require "spec_helper"

describe Emites::Entities::Base do

  class DummyEntity < Emites::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

3 entries across 3 versions & 1 rubygems

Version Path
emites-client-0.1.4 spec/emites/entities/base_spec.rb
emites-client-0.1.3 spec/emites/entities/base_spec.rb
emites-client-0.1.2 spec/emites/entities/base_spec.rb