930b917295
The specs were relying a lot on mock and stubs. I suspect that under certain circumstances it didn't play well with fabricators and we ended up with the stub of another spec causing this kind of error: ``` 1) Chat::AutoJoinChannelBatch.call when arguments are valid when channel is found when more than one membership is created publishes an event Failure/Error: subject(:result) { described_class.call(params) } Mocha::ExpectationError: unexpected invocation: Chat::Publisher.publish_new_channel(#<Chat::CategoryChannel:0x39b840>, #<User::ActiveRecord_Relation:0x39b868>) unsatisfied expectations: - expected exactly once, invoked never: Chat::Publisher.publish_new_channel(#<Chat::CategoryChannel:0x39b890>, [#<User:0x39b8b8>, #<User:0x39b8e0>]) satisfied expectations: - allowed any number of times, invoked once: Chat::Action::CreateMembershipsForAutoJoin.call(has_entries({:channel => #<Chat::CategoryChannel:0x39b890>, :contract => instance_of(Chat::AutoJoinChannelBatch::Contract)})) - allowed any number of times, invoked never: Chat::ChannelMembershipManager.new(#<Chat::CategoryChannel:0x39b890>) - allowed any number of times, invoked never: #<Mock:0x39b930>.recalculate_user_count(any_parameters) # ./plugins/chat/app/services/chat/auto_join_channel_batch.rb:65:in `publish_new_channel' # ./plugins/chat/app/services/service/base.rb:118:in `instance_exec' # ./plugins/chat/app/services/service/base.rb:118:in `call' # ./plugins/chat/app/services/service/base.rb:368:in `block in run!' # ./plugins/chat/app/services/service/base.rb:368:in `each' # ./plugins/chat/app/services/service/base.rb:368:in `run!' # ./plugins/chat/app/services/service/base.rb:361:in `run' # ./plugins/chat/app/services/service/base.rb:229:in `call' # ./plugins/chat/spec/services/chat/auto_join_channel_batch_spec.rb:50:in `block (3 levels) in <main>' # ./plugins/chat/spec/services/chat/auto_join_channel_batch_spec.rb:110:in `block (6 levels) in <main>' # ./spec/rails_helper.rb:412:in `block (2 levels) in <top (required)>' ``` The spec is now simplified and shouldn't have this issue anymore. |
||
---|---|---|
.. | ||
chat | ||
checklist | ||
discourse-details | ||
discourse-lazy-videos | ||
discourse-local-dates | ||
discourse-narrative-bot | ||
discourse-presence | ||
poll | ||
styleguide |