diff options
author | utilum <oz@utilum.com> | 2018-05-13 18:00:54 +0200 |
---|---|---|
committer | utilum <oz@utilum.com> | 2018-05-22 02:29:18 +0200 |
commit | 78288f75e127182751938353ef3005a29d9c3bc1 (patch) | |
tree | 7bbb3fb358348e2f2968ddfa59274568d06ef19b /actioncable/test/channel | |
parent | 6c574ac58993512f975ddaf1f679c5956cc576df (diff) | |
download | rails-78288f75e127182751938353ef3005a29d9c3bc1.tar.gz rails-78288f75e127182751938353ef3005a29d9c3bc1.tar.bz2 rails-78288f75e127182751938353ef3005a29d9c3bc1.zip |
remove unnecessary mocking in ActionCable tests
Diffstat (limited to 'actioncable/test/channel')
-rw-r--r-- | actioncable/test/channel/stream_test.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/actioncable/test/channel/stream_test.rb b/actioncable/test/channel/stream_test.rb index 53dd7e5b77..5c1f308f53 100644 --- a/actioncable/test/channel/stream_test.rb +++ b/actioncable/test/channel/stream_test.rb @@ -54,13 +54,13 @@ module ActionCable::StreamTests test "streaming start and stop" do run_in_eventmachine do connection = TestConnection.new - connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("test_room_1", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) } + connection.pubsub.expects(:subscribe).with("test_room_1", kind_of(Proc), kind_of(Proc)) channel = ChatChannel.new connection, "{id: 1}", id: 1 channel.subscribe_to_channel wait_for_async - connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } + connection.pubsub.expects(:unsubscribe) channel.unsubscribe_from_channel end end @@ -68,13 +68,14 @@ module ActionCable::StreamTests test "stream from non-string channel" do run_in_eventmachine do connection = TestConnection.new - connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("channel", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) } + connection.pubsub.expects(:subscribe).with("channel", kind_of(Proc), kind_of(Proc)) + channel = SymbolChannel.new connection, "" channel.subscribe_to_channel wait_for_async - connection.expects(:pubsub).returns mock().tap { |m| m.expects(:unsubscribe) } + connection.pubsub.expects(:unsubscribe) channel.unsubscribe_from_channel end end @@ -82,7 +83,7 @@ module ActionCable::StreamTests test "stream_for" do run_in_eventmachine do connection = TestConnection.new - connection.expects(:pubsub).returns mock().tap { |m| m.expects(:subscribe).with("action_cable:stream_tests:chat:Room#1-Campfire", kind_of(Proc), kind_of(Proc)).returns stub_everything(:pubsub) } + connection.pubsub.expects(:subscribe).with("action_cable:stream_tests:chat:Room#1-Campfire", kind_of(Proc), kind_of(Proc)) channel = ChatChannel.new connection, "" channel.subscribe_to_channel |