15
spec/controllers/room_channel_spec.rb
Normal file
15
spec/controllers/room_channel_spec.rb
Normal file
@@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe RoomChannel, type: :channel do
|
||||
let!(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
stub_connection
|
||||
end
|
||||
|
||||
it 'subscribes to a stream when pubsub_token is provided' do
|
||||
subscribe(pubsub_token: user.uid)
|
||||
expect(subscription).to be_confirmed
|
||||
expect(subscription).to have_stream_for(user.uid)
|
||||
end
|
||||
end
|
||||
@@ -4,6 +4,8 @@ require File.expand_path('../config/environment', __dir__)
|
||||
# Prevent database truncation if the environment is production
|
||||
abort('The Rails environment is running in production mode!') if Rails.env.production?
|
||||
require 'rspec/rails'
|
||||
require 'action_cable/testing/rspec'
|
||||
|
||||
# Add additional requires below this line. Rails is not loaded until this point!
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
|
||||
Reference in New Issue
Block a user