yujinakayama / transpec

The RSpec syntax converter
http://yujinakayama.me/transpec/
MIT License
1.01k stars 52 forks source link

Translating to "match" instead of "match_array" for ActiveRecord relation #92

Closed KurtPreston closed 9 years ago

KurtPreston commented 10 years ago

Hey, great work with this! I've tried it against two projects and it worked almost flawlessly. I did encounter one error with the following line of code:

widgets.should =~ Widget.where('created_at > (?)', @time1 - 1.day).where('created_at < (?)', @time1 + 1.day)

This was erroneously translated to:

expect(widgets).to match(Widget.where('created_at > (?)', @time1 - 1.day).where('created_at < (?)', @time1 + 1.day))

However, this spec fails. I believe it should have used match_array instead of match. The following line works:

expect(widgets).to match_array(Widget.where('created_at > (?)', @time1 - 1.day).where('created_at < (?)', @time1 + 1.day))
yujinakayama commented 9 years ago

Thanks for the report, and sorry for this late response :wink: