mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
DEV: Move discourse-chat
to the core repo. (#18776)
As part of this move, we are also renaming `discourse-chat` to `chat`.
This commit is contained in:
24
plugins/chat/spec/support/examples/chatable_model.rb
Normal file
24
plugins/chat/spec/support/examples/chatable_model.rb
Normal file
@ -0,0 +1,24 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
RSpec.shared_examples "a chatable model" do
|
||||
describe "#chat_channel" do
|
||||
subject(:chat_channel) { chatable.chat_channel }
|
||||
|
||||
it "returns a new chat channel model" do
|
||||
expect(chat_channel).to have_attributes persisted?: false,
|
||||
class: channel_class,
|
||||
chatable: chatable
|
||||
end
|
||||
end
|
||||
|
||||
describe "#create_chat_channel!" do
|
||||
subject(:create_chat_channel) { chatable.create_chat_channel!(name: name) }
|
||||
|
||||
let(:name) { "a custom name" }
|
||||
|
||||
it "creates a proper chat channel" do
|
||||
expect { create_chat_channel }.to change { channel_class.count }.by(1)
|
||||
expect(channel_class.last).to have_attributes chatable: chatable, name: name
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user