telegram-bot icon indicating copy to clipboard operation
telegram-bot copied to clipboard

Strange rspec shared_conext `telegram/bot/integration/rails` behavior

Open pozabil opened this issue 2 years ago • 3 comments

When you require 'telegram/bot/rspec/integration/rails' as specified in the documentation, the shared_context telegram/bot/integration/rails is automatically included in all examples with the type: request metadata.

https://github.com/telegram-bot-rb/telegram-bot/blob/a16928267a7bbd75a77c43c54a41f886458524fe/lib/telegram/bot/rspec/integration/rails.rb#L3C73-L3C73

In my opinion, this behavior seems incorrect, as it can interfere with other type: request examples unrelated to telegram-bot.

pozabil avatar Oct 28 '23 23:10 pozabil

Hey, have you tried it in an unrelated test? https://www.rubydoc.info/github/rspec/rspec-core/RSpec%2FCore%2FConfiguration%3Ashared_context_metadata_behavior says that it's legacy behavior that was available in rspec <= 3.5. For modern rspec is line 27

printercu avatar Oct 31 '23 14:10 printercu

Yes, that's what I observed. Some of my tests with type: request started failing because one of the let variables changed, which also was defined within the context of telegram/bot/callback_query. I'm not using the shared_context_metadata_behavior setting, and I'm also using rspec-core version greater than 3.5.

pozabil avatar Oct 31 '23 15:10 pozabil

I can not reproduce this. Tested with rspec 3.12. Could you please prepare and share sample app with reproducer?

printercu avatar Dec 30 '23 16:12 printercu