Skip to content

Return FormResponse from IdV form submission#1517

Merged
jmhooper merged 1 commit intomasterfrom
jmhooper-return-form-responses
Jun 30, 2017
Merged

Return FormResponse from IdV form submission#1517
jmhooper merged 1 commit intomasterfrom
jmhooper-return-form-responses

Conversation

@jmhooper
Copy link
Contributor

Why: As part of backgrounding vendor proofing, it will be helpful for the IdV form objects to behave like the rest of the form objects in the app so we can extract them from the Idv::Step subclasses and invoke them in the controller.

Copy link
Contributor

@zachmargolis zachmargolis left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

Choose a reason for hiding this comment

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

reek is complaining aobut this.

We could probably make it happy by doing:

form_validate(params).success?

Copy link
Contributor

Choose a reason for hiding this comment

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

I just went ahead and fixed in 50f069e738d8fbf9c1fd901f11866ef324e6c0b6

Copy link
Contributor

Choose a reason for hiding this comment

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

What do you think about assigning valid? to a variable, like success, and then using the variable, to avoid calling valid? twice?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here about only calling valid? once.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can we also add expect(result).to be_kind_of(FormResponse) here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, there's probably a few places we can look for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed a commit to resolve all of these

Copy link
Contributor

Choose a reason for hiding this comment

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

add expect(result).to be_kind_of(FormResponse) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Add expect(result).to be_kind_of(FormResponse) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Add expect(result).to be_kind_of(FormResponse) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Was there a particular reason you changed these specs? These specs should still pass the way they were, right? Seems like these changes can be in a separate PR. They are a bit distracting from the purpose of this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this PR would be easier to review without these changes. Do you mind saving them for later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They did not pass because the step.submit would submit the form which would call FormResponse.new with different params than what the stub was looking for.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this PR would be easier to review without these changes. Do you mind saving them for later?

Out of sync here. Agree but the specs don't pass w/o them

Copy link
Contributor

Choose a reason for hiding this comment

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

I see the issue now. It's that the Step class is now calling #success? on the FormResponse object, and that method wasn't being stubbed. Your changes make sense now and I like what you did.

Copy link
Contributor

@monfresh monfresh left a comment

Choose a reason for hiding this comment

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

LGTM!

**Why**: As part of backgrounding vendor proofing, it will be helpful
for the IdV form objects to behave like the rest of the form objects in
the app so we can extract them from the `Idv::Step` subclasses and
invoke them in the controller.
@jmhooper jmhooper force-pushed the jmhooper-return-form-responses branch from 8144469 to ba9cd3c Compare June 30, 2017 14:21
@jmhooper jmhooper merged commit 67a92ff into master Jun 30, 2017
@jmhooper jmhooper deleted the jmhooper-return-form-responses branch June 30, 2017 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants