Sha256: 50b7577968f3f5e1e6f576d9964efa0167a9d5e68d87e50520d718c0ad818c0c

Contents?: true

Size: 771 Bytes

Versions: 7

Compression:

Stored size: 771 Bytes

Contents

require 'spec_helper'

describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do
  let(:attribute) { described_class.build(String, :name => :name) }

  it 'returns true when attributes have same type and options' do
    equal_attribute = described_class.build(String, :name => :name)
    expect(attribute == equal_attribute).to be_truthy
  end

  it 'returns false when attributes have different type' do
    different_attribute = described_class.build(Integer, :name => :name)
    expect(attribute == different_attribute).to be_falsey
  end

  it 'returns false when attributes have different options' do
    different_attribute = described_class.build(Integer, :name => :name_two)
    expect(attribute == different_attribute).to be_falsey
  end
end

Version data entries

7 entries across 7 versions & 3 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/comparison_spec.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/comparison_spec.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/virtus-2.0.0/spec/unit/virtus/attribute/comparison_spec.rb
virtus2-2.1.0 spec/unit/virtus/attribute/comparison_spec.rb
virtus2-2.0.2 spec/unit/virtus/attribute/comparison_spec.rb
virtus2-2.0.1 spec/unit/virtus/attribute/comparison_spec.rb
virtus-2.0.0 spec/unit/virtus/attribute/comparison_spec.rb