-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add specs for attributes comparison (based on latest Equalizer gem wo…
…rking version)
- Loading branch information
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'spec_helper' | ||
|
||
describe Virtus::Attribute, '#== (defined by including Virtus::Equalizer)' do | ||
let(:attribute) { described_class.build(String, :name => :name) } | ||
|
||
# Currently that's the way it works and it happens because default_value objects | ||
# don't have equalizer, resulting in attributes object mismatch. | ||
# This behavior (and a spec) will need a change in future. | ||
it 'returns false when attributes have same type and options' do | ||
equal_attribute = described_class.build(String, :name => :name) | ||
expect(attribute == equal_attribute).to be_falsey | ||
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 |