Nasıl bir ActionCable için bir test yazıyorsunuz Connection
RSpec içinde? Bulduğum belgeleri ve diğer soruları test hakkında Channel
s, ama ben zor bir zaman test hakkında bilgi bulma yaşıyorum Connection
s.
Nasıl bir ActionCable bağlantısını test edersiniz?
oy
0
1 cevaplar
oy 0
0

Aksiyon kablo test taş testi için destek içerir Connection
s. İşte belgeler var: https://github.com/palkan/action-cable-testing#rspec-usage
Ve burada belgelerinde verilen RSpec örnek:
require "rails_helper"
RSpec.describe ApplicationCable::Connection, type: :channel do
it "successfully connects" do
connect "/cable", headers: { "X-USER-ID" => "325" }
expect(connection.user_id).to eq "325"
end
it "rejects connection" do
expect { connect "/cable" }.to have_rejected_connection
end
end