Sha256: 5c892e1fb355112d16238f942e874c0852c8a62d98c7ce309b74283dd3aedc33
Contents?: true
Size: 802 Bytes
Versions: 8
Compression:
Stored size: 802 Bytes
Contents
require 'spec_helper' describe Yaoc::Helper::StructHashConstructor do subject{ Yaoc::Helper::StructH(:id, :name).new(id: 1, name: "no name") } it "creates a struct with a hash enabled constructor" do expect(subject.id).to eq 1 expect(subject.name).to eq "no name" end context "with equal support" do subject{ Yaoc::Helper::StructHE(:id, :name) } it "returns true when all attributes are equal" do first = subject.new(id: 1, name: "no name") second = subject.new(id: 1, name: "no name") expect(first).to eq second end it "returns false when not all atributes are equal" do first = subject.new(id: 1, name: "no name") second = subject.new(id: 1, name: "no name2") expect(first).not_to eq second end end end
Version data entries
8 entries across 8 versions & 1 rubygems