-
-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
validate_after_scope_change? use compact before retrieving max #677
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -664,6 +664,21 @@ | |
end | ||
end | ||
|
||
context 'when the scope_to is used and existing records contain nil values on scoped attribute' do | ||
it 'still works' do | ||
model = define_model_validating_uniqueness( | ||
scopes: [name: :scope1]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indent the first parameter one step more than the previous line. |
||
|
||
create_record_from(model, attribute_name: 'uniq 1', scope1: 'uniq 1') | ||
create_record_from(model, attribute_name: 'rec with nil desc', scope1: nil) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [81/80] |
||
record = build_record_from(model, attribute_name: 'this should be ok', scope1: 'this should be ok') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [105/80] |
||
|
||
expect(record). | ||
to validate_uniqueness. | ||
scoped_to(:scope1) | ||
end | ||
end | ||
|
||
let(:model_attributes) { {} } | ||
|
||
def default_attribute | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line is too long. [100/80]