Created
April 28, 2020 07:39
-
-
Save nlinn/fbd0ee2fcabe67ecacefa68de731bb2d to your computer and use it in GitHub Desktop.
Unexpected validation result
This file contains hidden or 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
class DoSomething < ActiveInteractor::Base | |
def perform | |
end | |
end | |
class DoSomethingContext < ActiveInteractor::Context::Base | |
attribute :my_attribute | |
validates :my_attribute, presence: true, on: :calling | |
end | |
result = DoSomething.perform(my_attribute: nil) | |
result.success? | |
# => false (expected) | |
result.valid? | |
# => true (unexpexted!) | |
result.errors.any? | |
# => false (unexpexted!) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment