Skip to content
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

Fixes tests and updates dry validation version #2

Merged
merged 3 commits into from
Jan 28, 2017

Conversation

andrewaguiar
Copy link
Collaborator

I tried to use this project and ended up getting some errors, I started investigating the causes and noticed the dry validation used was old, and there were some errors in spec_helper (related to SimpleCov configuring).

  • Fixes tests
  • Updates dry validation
  • Updates examples

@andrewaguiar
Copy link
Collaborator Author

#1 (comment)

Copy link
Owner

@michaelherold michaelherold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple questions for you. I'm guessing the change was necessitated due to updating the dry-validation version?

@@ -164,7 +164,7 @@ def define_assurances_hook

after do
assurances = self.class.assurances.new
result = assurances.call(context)
result = assurances.call(context.to_h)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this throwing an error? Since the Interactor::Context object is based on OpenStruct, it used to be handled automatically by dry-validation. I would rather rely on dry-validation's handling of OpenStructs if possible.

I'm guessing it was due to how the required macro works?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, when I started testing it it was raising a NoMethodError: undefined method key?' for, it seems dry-validation started checking for keys using #key?` method which doesn't exist in OpenStruct neither Context.

@@ -189,7 +189,7 @@ def define_expectations_hook

before do
expectations = self.class.expectations.new
result = expectations.call(context)
result = expectations.call(context.to_h)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above with the other call to #to_h.

require "codeclimate-test-reporter"
CodeClimate::TestReporter.start
require 'simplecov'
SimpleCov.start
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should get the codeclimate-test-reporter to work again, but that's outside the scope of this right now.

Copy link
Owner

@michaelherold michaelherold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I'm not a big fan of having to explicitly dump the Context to a Hash, but it seems like what we're going to have to do for the time being.

Thanks for the contribution!

@michaelherold michaelherold merged commit 8f0a281 into michaelherold:master Jan 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants