diff --git a/spec/channels/imports_channel_spec.rb b/spec/channels/imports_channel_spec.rb index 5c90a328..3b7391be 100644 --- a/spec/channels/imports_channel_spec.rb +++ b/spec/channels/imports_channel_spec.rb @@ -4,32 +4,15 @@ require 'rails_helper' RSpec.describe ImportsChannel, type: :channel do let(:user) { create(:user) } - let(:import) { create(:import) } - before { stub_connection current_user: user } - - describe '#subscribe' do - it 'confirms the subscription and subscribes to a stream' do - subscribe(import_id: import.id) - - expect(subscription).to be_confirmed - expect(subscription).to have_stream_for(import) - end - - it 'rejects the subscription without import_id' do - subscribe - - expect(subscription).to be_rejected - end + before do + stub_connection(current_user: user) end - describe '#broadcast' do - it 'broadcasts a message to the stream' do - subscribe(import_id: import.id) + it 'subscribes to a stream for the current user' do + subscribe - expect do - ImportsChannel.broadcast_to(import, message: 'Test message') - end.to have_broadcasted_to(import).with(message: 'Test message') - end + expect(subscription).to be_confirmed + expect(subscription).to have_stream_for(user) end end diff --git a/spec/channels/notifications_channel_spec.rb b/spec/channels/notifications_channel_spec.rb index 7e3543d4..22b43ef2 100644 --- a/spec/channels/notifications_channel_spec.rb +++ b/spec/channels/notifications_channel_spec.rb @@ -1,5 +1,18 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe NotificationsChannel, type: :channel do - pending "add some examples to (or delete) #{__FILE__}" + let(:user) { create(:user) } + + before do + stub_connection(current_user: user) + end + + it 'subscribes to a stream for the current user' do + subscribe + + expect(subscription).to be_confirmed + expect(subscription).to have_stream_for(user) + end end diff --git a/spec/channels/points_channel_spec.rb b/spec/channels/points_channel_spec.rb index 5ca00454..b04b599f 100644 --- a/spec/channels/points_channel_spec.rb +++ b/spec/channels/points_channel_spec.rb @@ -1,5 +1,18 @@ +# frozen_string_literal: true + require 'rails_helper' RSpec.describe PointsChannel, type: :channel do - pending "add some examples to (or delete) #{__FILE__}" + let(:user) { create(:user) } + + before do + stub_connection(current_user: user) + end + + it 'subscribes to a stream for the current user' do + subscribe + + expect(subscription).to be_confirmed + expect(subscription).to have_stream_for(user) + end end