testdouble/mocktail

SyntaxError when upgrading from 1.2.0 to 1.2.1

Closed this issue · 4 comments

nshki commented

I just upgraded Mocktail from 1.2.0 to 1.2.1 on a project with no other changes and started seeing this error:

Error:
ReactionEventsTest#test_reaction_added_events_are_logged:
SyntaxError: /usr/local/bundle/gems/mocktail-1.2.1/lib/mocktail/imitates_type/makes_double/declares_dry_class.rb:60: syntax error, unexpected '=', expecting ')'
            ->( = ((__mocktail_default_args ||...
                ^
/usr/local/bundle/gems/mocktail-1.2.1/lib/mocktail/imitates_type/makes_double/declares_dry_class.rb:60: syntax error, unexpected ']', expecting literal content or terminator or tSTRING_DBEG or tSTRING_DVAR
...ocktail_default_args ||= {})[:] = nil), &blk) do

The corresponding line in my test suite that this is tied to looks like:

slack_client_mock = Mocktail.of_next(Slack::Web::Client)

The way I'm getting around this is by wrapping calls to the third party Slack library in a PORO and mocking instances of said PORO, but wanted to open this issue just in case.

Could you please share your ruby version?

nshki commented

Yep, it’s 3.1.2.

Thanks for identifying this issue. Fixes by #19 and landed in 1.2.2

nshki commented

Thanks for fixing it so quickly!