discourse/plugins/chat/spec
Joffrey JAFFEUX 930b917295
DEV: fixes flakey spec from auto-join-channel-batch (#23044)
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.
2023-08-09 22:37:28 +02:00
..
components/chat DEV: Add last_message_id to channel and thread (#22488) 2023-07-13 10:28:11 +10:00
fabricators DEV: Add last_message_id to channel and thread (#22488) 2023-07-13 10:28:11 +10:00
integration DEV: Remove experimental site setting for chat threads (#22720) 2023-07-26 12:46:23 +02:00
jobs DEV: moves logic from job to a service (#22691) 2023-07-27 10:25:41 +02:00
lib FIX: Don't create a reviewable when sending PM to user in chat (#22914) 2023-08-08 13:18:34 +02:00
mailers DEV: Refactor DM channel creation into new service pattern (#22144) 2023-07-03 10:18:37 +10:00
models DEV: Remove enable_experimental_hashtag_autocomplete logic (#22820) 2023-08-08 11:18:55 +10:00
queries/chat FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
requests FIX: prevents readonly mode to crash channel_messages#index (#22987) 2023-08-07 16:34:22 +02:00
serializer FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00
services DEV: fixes flakey spec from auto-join-channel-batch (#23044) 2023-08-09 22:37:28 +02:00
support FEATURE: Show unread in sidebar for unread channel threads (#22342) 2023-07-17 13:00:49 +10:00
system DEV: Raise exception when capybara finder times out (#22686) 2023-08-08 10:16:09 +01:00
validators DEV: properly namespace chat (#20690) 2023-03-17 14:24:38 +01:00
plugin_helper.rb DEV: Refactor DM channel creation into new service pattern (#22144) 2023-07-03 10:18:37 +10:00
plugin_spec.rb FEATURE: thread pagination (#22624) 2023-07-27 09:57:03 +02:00