File: comparison_spec.rb

package info (click to toggle)
ruby-virtus 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 660 kB
  • sloc: ruby: 4,378; makefile: 2
file content (20 lines) | stat: -rw-r--r-- 771 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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