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

Don't evaluate original parameter name when custom method is provided #352

Merged
merged 1 commit into from
Sep 27, 2017

Conversation

rafaelsales
Copy link
Contributor

@rafaelsales rafaelsales commented Jul 10, 2017

The method arg of parameter macro is used to solve conflicts with existing methods on the spec context. This works well when you define the value for method arg.
When the specified method is not defined, the original param name is used.

In the example below, the current behavior raises 'No response yet' because status is a reserved method of rack test.

get '/foo' do
  parameter :status, "Blah", method: :status_param # this param is not required

  example 'meh' do
    expect(status).to eq 200
  end
end

The PR removes the fallback that looks for the original param name when the provided method is not implemented.

More context here: #312 (comment)

@rafaelsales rafaelsales changed the title Forbid use of reserved parameter name Does not evaluate original parameter name when custom method is provided Jul 10, 2017
@rafaelsales rafaelsales changed the title Does not evaluate original parameter name when custom method is provided Don't evaluate original parameter name when custom method is provided Jul 10, 2017
@kurko
Copy link
Contributor

kurko commented Jul 10, 2017

Can you please add a description with the problem you're solving?

@rafaelsales
Copy link
Contributor Author

Done!

@oestrich oestrich merged commit 16f6fea into zipmark:master Sep 27, 2017
@oestrich
Copy link
Contributor

Sorry for the slow response. Thanks for the PR!

@rafaelsales
Copy link
Contributor Author

Thanks man!

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.

3 participants