You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, I would actually address 3 issues here but since they all related to the same method they might have a single solution.
First
Each matcher includes following code: failure_message { |actual| "expect #{form.inspect} (#{attributes}) to have #{method} method param" }
Anytime any of the matchers fails I receive the following error:
I was not able to reproduce this error using rspec-hanami repo and haml though. However I'm sure I'm just missing out something that happens under Hanami's hood.
Second
Whenever form matcher fail failure_message would output multi page diff of a FormBuilder object which is overkill.
Third
have_field matcher's failure_message includes errors. Look at that, there is no #{form.inspect}, #{attributes} or #{method} defined within matcher. Obviously that's must be a copy-paste issue from 'have_method' matcher.
matcher:have_fielddo |params|
require'hanami/utils/hash'attr_reader:form,:form_data,:paramsdescription{"have field with params"}matchdo |form|
@form=form@params= ::Hanami::Utils::Hash.new(params).symbolize!@form_data=RSpec::Hanami::FormParser.new.call(form.to_s)form_data.any?do |input|
input.merge(params) == params.merge(input)endendfailure_message{ |actual| "expect #{form.inspect} (#{attributes}) to have #{method} method param"}diffableend
Solution
So as I mentioned one approach might handle all three issues:
Output @form_data = RSpec::Hanami::FormParser.new.call(form.to_s) instead of '#{form.inspect}' in `failure_message' of every matcher.
Remove diffable for every form matcher.
Fix have_field matcher's failure_message with params.
The text was updated successfully, but these errors were encountered:
Ok, I would actually address 3 issues here but since they all related to the same method they might have a single solution.
First
Each matcher includes following code:
failure_message { |actual| "expect #{form.inspect} (#{attributes}) to have #{method} method param" }
Anytime any of the matchers fails I receive the following error:
This error comes from the
#{form.inspect}
operation when RSpec generates failure message and originates inhaml
'sinspect
method (which callsgsub!
with a frozen string option enabled).I was not able to reproduce this error using
rspec-hanami
repo andhaml
though. However I'm sure I'm just missing out something that happens under Hanami's hood.Second
Whenever form matcher fail
failure_message
would output multi page diff of aFormBuilder
object which is overkill.Third
have_field
matcher'sfailure_message
includes errors. Look at that, there is no#{form.inspect}
,#{attributes}
or#{method}
defined within matcher. Obviously that's must be a copy-paste issue from 'have_method' matcher.Solution
So as I mentioned one approach might handle all three issues:
@form_data = RSpec::Hanami::FormParser.new.call(form.to_s)
instead of '#{form.inspect}' in `failure_message' of every matcher.diffable
for every form matcher.have_field
matcher'sfailure_message
withparams
.The text was updated successfully, but these errors were encountered: