aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable
diff options
context:
space:
mode:
authoryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-01-25 09:46:29 +0900
committeryuuji.yaginuma <yuuji.yaginuma@gmail.com>2017-01-25 09:58:15 +0900
commitc42bd31977d601a743a154cf5a614459b51a3cb3 (patch)
tree2d52a01d303e0ec2ca1cbb4d9eeb07e822bf2298 /actioncable
parentc6f9f8c28a720ad4ec7cf3613dddfa451d5968e2 (diff)
downloadrails-c42bd31977d601a743a154cf5a614459b51a3cb3.tar.gz
rails-c42bd31977d601a743a154cf5a614459b51a3cb3.tar.bz2
rails-c42bd31977d601a743a154cf5a614459b51a3cb3.zip
correctly check error message
`assert_raise` does not check error message. However, in some tests, it seems like expecting error message checking with `assert_raise`. Instead of specifying an error message in `assert_raise`, modify to use another assert to check the error message.
Diffstat (limited to 'actioncable')
-rw-r--r--actioncable/test/channel/periodic_timers_test.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/actioncable/test/channel/periodic_timers_test.rb b/actioncable/test/channel/periodic_timers_test.rb
index 0cc4992ef6..17a8e45a35 100644
--- a/actioncable/test/channel/periodic_timers_test.rb
+++ b/actioncable/test/channel/periodic_timers_test.rb
@@ -38,23 +38,26 @@ class ActionCable::Channel::PeriodicTimersTest < ActiveSupport::TestCase
test "disallow negative and zero periods" do
[ 0, 0.0, 0.seconds, -1, -1.seconds, "foo", :foo, Object.new ].each do |invalid|
- assert_raise ArgumentError, /Expected every:/ do
+ e = assert_raise ArgumentError do
ChatChannel.periodically :send_updates, every: invalid
end
+ assert_match(/Expected every:/, e.message)
end
end
test "disallow block and arg together" do
- assert_raise ArgumentError, /not both/ do
+ e = assert_raise ArgumentError do
ChatChannel.periodically(:send_updates, every: 1) { ping }
end
+ assert_match(/not both/, e.message)
end
test "disallow unknown args" do
[ "send_updates", Object.new, nil ].each do |invalid|
- assert_raise ArgumentError, /Expected a Symbol/ do
+ e = assert_raise ArgumentError do
ChatChannel.periodically invalid, every: 1
end
+ assert_match(/Expected a Symbol/, e.message)
end
end