-
Notifications
You must be signed in to change notification settings - Fork 369
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
Comparison of Array with Array failed for marks
and text
#1108
base: develop
Are you sure you want to change the base?
Conversation
When I called `marks` and `text` on my app, I got: ```irb(main):001:0> marks ArgumentError: comparison of Array with Array failed from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:41:in `sort' from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:41:in `marks' from (irb):1 from /usr/bin/irb:12:in `<main>' ``` ```irb(main):002:0> text ArgumentError: comparison of Array with Array failed from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:158:in `sort' from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:158:in `print_marks' from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:223:in `text_marks' from /Library/Ruby/Gems/2.0.0/gems/calabash-cucumber-0.19.1/lib/calabash-cucumber/console_helpers.rb:25:in `text' from (irb):2 from /usr/bin/irb:12:in `<main>' ```
@TeresaP The unit tests are failing.
|
Thanks @jmoody. I think the original method is choking because some of the array values are nil, like this: What's another way we can solve this? |
On the array with nils - call |
@jmoody I think that causes a problem because sometimes we would end up with 2-element arrays and sometimes we would end up with 3-element arrays. Substituting empty strings for nil values seems to work though. |
Replace nil elements with empty string for marks and print_marks
@TeresaP Don't be afraid to update the tests if you think the behavior can be improved. |
# Replace nil elements with empty string to avoid "ArgumentError: comparison of Array with Array failed" error | ||
marks.each { |elm| | ||
elm.map! {|e| e ? e : ''} | ||
} | ||
marks.sort_by.each { |elm| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you replace at this line sort_by
with 'sort'?
I think this is the root cause for failing tests ;)
@TeresaP please take a look on my comment i think i find why tests failing. |
@ark-konopacki thanks for taking a look :). I will have to give that a shot! |
@TeresaP I want to get this merged. Can you provide me a way to reproduce? |
I reproduced!!!! |
@jmoody the only one issue with this PR is failing tests |
When I called
marks
andtext
on my app, I got: