uniform_notifier 1.11.0 → 1.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/Gemfile +3 -1
  4. data/README.md +18 -1
  5. data/Rakefile +13 -11
  6. data/lib/uniform_notifier.rb +8 -7
  7. data/lib/uniform_notifier/airbrake.rb +2 -0
  8. data/lib/uniform_notifier/base.rb +17 -14
  9. data/lib/uniform_notifier/bugsnag.rb +5 -3
  10. data/lib/uniform_notifier/customized_logger.rb +6 -4
  11. data/lib/uniform_notifier/errors.rb +3 -1
  12. data/lib/uniform_notifier/growl.rb +23 -20
  13. data/lib/uniform_notifier/honeybadger.rb +2 -0
  14. data/lib/uniform_notifier/javascript_alert.rb +7 -3
  15. data/lib/uniform_notifier/javascript_console.rb +18 -14
  16. data/lib/uniform_notifier/rails_logger.rb +3 -1
  17. data/lib/uniform_notifier/raise.rb +3 -1
  18. data/lib/uniform_notifier/rollbar.rb +2 -0
  19. data/lib/uniform_notifier/sentry.rb +2 -0
  20. data/lib/uniform_notifier/slack.rb +20 -19
  21. data/lib/uniform_notifier/terminal_notifier.rb +23 -0
  22. data/lib/uniform_notifier/version.rb +3 -1
  23. data/lib/uniform_notifier/xmpp.rb +26 -23
  24. data/spec/spec_helper.rb +8 -6
  25. data/spec/uniform_notifier/airbrake_spec.rb +12 -10
  26. data/spec/uniform_notifier/base_spec.rb +10 -8
  27. data/spec/uniform_notifier/bugsnag_spec.rb +21 -19
  28. data/spec/uniform_notifier/customized_logger_spec.rb +9 -7
  29. data/spec/uniform_notifier/growl_spec.rb +19 -18
  30. data/spec/uniform_notifier/honeybadger_spec.rb +12 -10
  31. data/spec/uniform_notifier/javascript_alert_spec.rb +29 -9
  32. data/spec/uniform_notifier/javascript_console_spec.rb +55 -17
  33. data/spec/uniform_notifier/rails_logger_spec.rb +9 -7
  34. data/spec/uniform_notifier/raise_spec.rb +13 -11
  35. data/spec/uniform_notifier/rollbar_spec.rb +8 -6
  36. data/spec/uniform_notifier/sentry_spec.rb +12 -10
  37. data/spec/uniform_notifier/slack_spec.rb +10 -8
  38. data/spec/uniform_notifier/terminal_notifier_spec.rb +25 -0
  39. data/spec/uniform_notifier/xmpp_spec.rb +17 -15
  40. data/uniform_notifier.gemspec +18 -17
  41. metadata +6 -3
@@ -1,25 +1,27 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  class Honeybadger
4
6
  # mock Honeybadger
5
7
  end
6
8
 
7
9
  RSpec.describe UniformNotifier::HoneybadgerNotifier do
8
- it "should not notify honeybadger" do
9
- expect(UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(:title => "notify honeybadger")).to be_nil
10
+ it 'should not notify honeybadger' do
11
+ expect(UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')).to be_nil
10
12
  end
11
13
 
12
- it "should notify honeybadger" do
13
- expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new("notify honeybadger"), {})
14
+ it 'should notify honeybadger' do
15
+ expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), {})
14
16
 
15
17
  UniformNotifier.honeybadger = true
16
- UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(:title => "notify honeybadger")
18
+ UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')
17
19
  end
18
20
 
19
- it "should notify honeybadger" do
20
- expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new("notify honeybadger"), :foo => :bar)
21
+ it 'should notify honeybadger' do
22
+ expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), foo: :bar)
21
23
 
22
- UniformNotifier.honeybadger = { :foo => :bar }
23
- UniformNotifier::HoneybadgerNotifier.out_of_channel_notify("notify honeybadger")
24
+ UniformNotifier.honeybadger = { foo: :bar }
25
+ UniformNotifier::HoneybadgerNotifier.out_of_channel_notify('notify honeybadger')
24
26
  end
25
27
  end
@@ -1,16 +1,36 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  RSpec.describe UniformNotifier::JavascriptAlert do
4
- it "should not notify message" do
5
- expect(UniformNotifier::JavascriptAlert.inline_notify(:title => "javascript alert!")).to be_nil
6
+ it 'should not notify message' do
7
+ expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to be_nil
6
8
  end
7
9
 
8
- it "should notify message" do
10
+ it 'should notify message' do
9
11
  UniformNotifier.alert = true
10
- expect(UniformNotifier::JavascriptAlert.inline_notify(:title => "javascript alert!")).to eq <<-CODE
11
- <script type="text/javascript">/*<![CDATA[*/
12
- alert( "javascript alert!" );
13
- /*]]>*/</script>
14
- CODE
12
+ expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
13
+ <script type="text/javascript">/*<![CDATA[*/
14
+ alert( "javascript alert!" );
15
+ /*]]>*/</script>
16
+ CODE
17
+ end
18
+
19
+ it 'should accept custom attributes' do
20
+ UniformNotifier.alert = { attributes: { nonce: 'my-nonce', 'data-key' => :value } }
21
+ expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
22
+ <script type="text/javascript" nonce="my-nonce" data-key="value">/*<![CDATA[*/
23
+ alert( "javascript alert!" );
24
+ /*]]>*/</script>
25
+ CODE
26
+ end
27
+
28
+ it 'should have default attributes if no attributes settings exist' do
29
+ UniformNotifier.alert = {}
30
+ expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to eq <<~CODE
31
+ <script type="text/javascript">/*<![CDATA[*/
32
+ alert( "javascript alert!" );
33
+ /*]]>*/</script>
34
+ CODE
15
35
  end
16
36
  end
@@ -1,25 +1,63 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  RSpec.describe UniformNotifier::JavascriptConsole do
4
- it "should not notify message" do
5
- expect(UniformNotifier::JavascriptConsole.inline_notify(:title => "javascript console!")).to be_nil
6
+ it 'should not notify message' do
7
+ expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to be_nil
6
8
  end
7
9
 
8
- it "should notify message" do
10
+ it 'should notify message' do
9
11
  UniformNotifier.console = true
10
- expect(UniformNotifier::JavascriptConsole.inline_notify(:title => "javascript console!")).to eq <<-CODE
11
- <script type="text/javascript">/*<![CDATA[*/
12
- if (typeof(console) !== 'undefined' && console.log) {
13
- if (console.groupCollapsed && console.groupEnd) {
14
- console.groupCollapsed(#{"Uniform Notifier".inspect});
15
- console.log(#{"javascript console!".inspect});
16
- console.groupEnd();
17
- } else {
18
- console.log(#{"javascript console!".inspect});
19
- }
20
- }
21
-
22
- /*]]>*/</script>
12
+ expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
13
+ <script type="text/javascript">/*<![CDATA[*/
14
+ if (typeof(console) !== 'undefined' && console.log) {
15
+ if (console.groupCollapsed && console.groupEnd) {
16
+ console.groupCollapsed(#{'Uniform Notifier'.inspect});
17
+ console.log(#{'javascript console!'.inspect});
18
+ console.groupEnd();
19
+ } else {
20
+ console.log(#{'javascript console!'.inspect});
21
+ }
22
+ }
23
+
24
+ /*]]>*/</script>
25
+ CODE
26
+ end
27
+
28
+ it 'should accept custom attributes' do
29
+ UniformNotifier.console = { attributes: { nonce: 'my-nonce', 'data-key' => :value } }
30
+ expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
31
+ <script type="text/javascript" nonce="my-nonce" data-key="value">/*<![CDATA[*/
32
+ if (typeof(console) !== 'undefined' && console.log) {
33
+ if (console.groupCollapsed && console.groupEnd) {
34
+ console.groupCollapsed(#{'Uniform Notifier'.inspect});
35
+ console.log(#{'javascript console!'.inspect});
36
+ console.groupEnd();
37
+ } else {
38
+ console.log(#{'javascript console!'.inspect});
39
+ }
40
+ }
41
+
42
+ /*]]>*/</script>
43
+ CODE
44
+ end
45
+
46
+ it 'should have default attributes if no attributes settings exist' do
47
+ UniformNotifier.console = {}
48
+ expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to eq <<~CODE
49
+ <script type="text/javascript">/*<![CDATA[*/
50
+ if (typeof(console) !== 'undefined' && console.log) {
51
+ if (console.groupCollapsed && console.groupEnd) {
52
+ console.groupCollapsed(#{'Uniform Notifier'.inspect});
53
+ console.log(#{'javascript console!'.inspect});
54
+ console.groupEnd();
55
+ } else {
56
+ console.log(#{'javascript console!'.inspect});
57
+ }
58
+ }
59
+
60
+ /*]]>*/</script>
23
61
  CODE
24
62
  end
25
63
  end
@@ -1,20 +1,22 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  class Rails
4
6
  # mock Rails
5
7
  end
6
8
 
7
9
  RSpec.describe UniformNotifier::RailsLogger do
8
- it "should not notify rails logger" do
9
- expect(UniformNotifier::RailsLogger.out_of_channel_notify(:title => "notify rails logger")).to be_nil
10
+ it 'should not notify rails logger' do
11
+ expect(UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
10
12
  end
11
13
 
12
- it "should notify rails logger" do
13
- logger = double("logger")
14
+ it 'should notify rails logger' do
15
+ logger = double('logger')
14
16
  expect(Rails).to receive(:logger).and_return(logger)
15
- expect(logger).to receive(:warn).with("notify rails logger")
17
+ expect(logger).to receive(:warn).with('notify rails logger')
16
18
 
17
19
  UniformNotifier.rails_logger = true
18
- UniformNotifier::RailsLogger.out_of_channel_notify(:title => "notify rails logger")
20
+ UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')
19
21
  end
20
22
  end
@@ -1,31 +1,33 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  RSpec.describe UniformNotifier::Raise do
4
- it "should not notify message" do
5
- expect(UniformNotifier::Raise.out_of_channel_notify(:title => "notification")).to be_nil
6
+ it 'should not notify message' do
7
+ expect(UniformNotifier::Raise.out_of_channel_notify(title: 'notification')).to be_nil
6
8
  end
7
9
 
8
- it "should raise error of the default class" do
10
+ it 'should raise error of the default class' do
9
11
  UniformNotifier.raise = true
10
12
  expect {
11
- UniformNotifier::Raise.out_of_channel_notify(:title => "notification")
12
- }.to raise_error(UniformNotifier::Exception, "notification")
13
+ UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
14
+ }.to raise_error(UniformNotifier::Exception, 'notification')
13
15
  end
14
16
 
15
- it "allows the user to override the default exception class" do
17
+ it 'allows the user to override the default exception class' do
16
18
  klass = Class.new(Exception)
17
19
  UniformNotifier.raise = klass
18
20
  expect {
19
- UniformNotifier::Raise.out_of_channel_notify(:title => "notification")
20
- }.to raise_error(klass, "notification")
21
+ UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
22
+ }.to raise_error(klass, 'notification')
21
23
  end
22
24
 
23
- it "can be turned from on to off again" do
25
+ it 'can be turned from on to off again' do
24
26
  UniformNotifier.raise = true
25
27
  UniformNotifier.raise = false
26
28
 
27
29
  expect {
28
- UniformNotifier::Raise.out_of_channel_notify(:title => "notification")
30
+ UniformNotifier::Raise.out_of_channel_notify(title: 'notification')
29
31
  }.not_to raise_error
30
32
  end
31
33
  end
@@ -1,18 +1,20 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  class Rollbar
4
6
  # mock Rollbar
5
7
  end
6
8
 
7
9
  RSpec.describe UniformNotifier::RollbarNotifier do
8
- it "should not notify rollbar" do
9
- expect(UniformNotifier::RollbarNotifier.out_of_channel_notify(:title => "notify rollbar")).to be_nil
10
+ it 'should not notify rollbar' do
11
+ expect(UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')).to be_nil
10
12
  end
11
13
 
12
- it "should notify rollbar" do
13
- expect(Rollbar).to receive(:info).with(UniformNotifier::Exception.new("notify rollbar"))
14
+ it 'should notify rollbar' do
15
+ expect(Rollbar).to receive(:info).with(UniformNotifier::Exception.new('notify rollbar'))
14
16
 
15
17
  UniformNotifier.rollbar = true
16
- UniformNotifier::RollbarNotifier.out_of_channel_notify(:title => "notify rollbar")
18
+ UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')
17
19
  end
18
20
  end
@@ -1,25 +1,27 @@
1
- require "spec_helper"
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
2
4
 
3
5
  class Raven
4
6
  # mock Sentry
5
7
  end
6
8
 
7
9
  RSpec.describe UniformNotifier::SentryNotifier do
8
- it "should not notify sentry" do
9
- expect(UniformNotifier::SentryNotifier.out_of_channel_notify(:title => "notify sentry")).to be_nil
10
+ it 'should not notify sentry' do
11
+ expect(UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')).to be_nil
10
12
  end
11
13
 
12
- it "should notify sentry" do
13
- expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new("notify sentry"), {})
14
+ it 'should notify sentry' do
15
+ expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'), {})
14
16
 
15
17
  UniformNotifier.sentry = true
16
- UniformNotifier::SentryNotifier.out_of_channel_notify(:title => "notify sentry")
18
+ UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')
17
19
  end
18
20
 
19
- it "should notify sentry" do
20
- expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new("notify sentry"), :foo => :bar)
21
+ it 'should notify sentry' do
22
+ expect(Raven).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'), foo: :bar)
21
23
 
22
- UniformNotifier.sentry = { :foo => :bar }
23
- UniformNotifier::SentryNotifier.out_of_channel_notify("notify sentry")
24
+ UniformNotifier.sentry = { foo: :bar }
25
+ UniformNotifier::SentryNotifier.out_of_channel_notify('notify sentry')
24
26
  end
25
27
  end
@@ -1,17 +1,19 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe UniformNotifier::Slack do
4
6
  context 'not enabled' do
5
7
  it 'should not notify slack' do
6
8
  expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
7
- expect(UniformNotifier::Slack.out_of_channel_notify(:title => 'notify slack')).to be_nil
9
+ expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
8
10
  end
9
11
  end
10
12
 
11
13
  context 'configuration' do
12
14
  context 'no webhook_url is given' do
13
15
  it 'should raise an error' do
14
- expect{ UniformNotifier.slack = {} }.to raise_error(UniformNotifier::NotificationError)
16
+ expect { UniformNotifier.slack = {} }.to raise_error(UniformNotifier::NotificationError)
15
17
  end
16
18
 
17
19
  it 'should not notify slack' do
@@ -20,20 +22,20 @@ RSpec.describe UniformNotifier::Slack do
20
22
  rescue UniformNotifier::NotificationError
21
23
  ensure
22
24
  expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
23
- expect(UniformNotifier::Slack.out_of_channel_notify(:title => 'notify slack')).to be_nil
25
+ expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
24
26
  end
25
27
  end
26
28
  end
27
29
 
28
30
  it 'should remove invalid options' do
29
31
  expect(Slack::Notifier).to receive(:new).with('http://some.slack.url', {}).and_return(true)
30
- UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :pizza => 'pepperoni' }
32
+ UniformNotifier.slack = { webhook_url: 'http://some.slack.url', pizza: 'pepperoni' }
31
33
  expect(UniformNotifier::Slack.active?).to eq true
32
34
  end
33
35
 
34
36
  it 'should allow username and channel config options' do
35
- expect(Slack::Notifier).to receive(:new).with('http://some.slack.url', { :username => 'The Dude', :channel => '#carpets' }).and_return(true)
36
- UniformNotifier.slack = { :webhook_url => 'http://some.slack.url', :username => 'The Dude', :channel => '#carpets' }
37
+ expect(Slack::Notifier).to receive(:new).with('http://some.slack.url', username: 'The Dude', channel: '#carpets').and_return(true)
38
+ UniformNotifier.slack = { webhook_url: 'http://some.slack.url', username: 'The Dude', channel: '#carpets' }
37
39
  expect(UniformNotifier::Slack.active?).to eq true
38
40
  end
39
41
  end
@@ -45,9 +47,9 @@ RSpec.describe UniformNotifier::Slack do
45
47
  end
46
48
 
47
49
  it 'should notify slack' do
48
- UniformNotifier.slack = { :webhook_url => 'http://some.slack.url' }
50
+ UniformNotifier.slack = { webhook_url: 'http://some.slack.url' }
49
51
  expect_any_instance_of(Slack::Notifier).to receive(:ping)
50
- expect(UniformNotifier::Slack.out_of_channel_notify(:title => @message)).to eq @message
52
+ expect(UniformNotifier::Slack.out_of_channel_notify(title: @message)).to eq @message
51
53
  end
52
54
  end
53
55
  end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ RSpec.describe UniformNotifier::TerminalNotifier do
6
+ it 'should not notify terminal-notifier when disabled' do
7
+ expect(UniformNotifier::TerminalNotifier.out_of_channel_notify(title: 'notify terminal')).to be_nil
8
+ end
9
+
10
+ it "should raise an exception when terminal-notifier gem isn't available" do
11
+ UniformNotifier.terminal_notifier = true
12
+ expect { UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal') }.to raise_error(UniformNotifier::NotificationError, /terminal-notifier gem/)
13
+ end
14
+
15
+ it 'should notify terminal-notifier when enabled' do
16
+ module TerminalNotifier
17
+ # mock TerminalNotifier
18
+ end
19
+
20
+ expect(TerminalNotifier).to receive(:notify).with('body', title: 'notify terminal')
21
+
22
+ UniformNotifier.terminal_notifier = true
23
+ UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
24
+ end
25
+ end
@@ -1,50 +1,52 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  RSpec.describe UniformNotifier::Xmpp do
4
- it "should not notify xmpp" do
5
- expect(UniformNotifier::Xmpp.out_of_channel_notify(:title => "notify xmpp")).to be_nil
6
+ it 'should not notify xmpp' do
7
+ expect(UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')).to be_nil
6
8
  end
7
9
 
8
- it "should notify xmpp without online status" do
9
- jid = double("jid")
10
- xmpp = double("xmpp")
10
+ it 'should notify xmpp without online status' do
11
+ jid = double('jid')
12
+ xmpp = double('xmpp')
11
13
  expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
12
14
  expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
13
15
  expect(xmpp).to receive(:connect)
14
16
  expect(xmpp).to receive(:auth).with('123456')
15
17
 
16
- message = double("message")
18
+ message = double('message')
17
19
  expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
18
20
  expect(message).to receive(:set_type).with(:normal).and_return(message)
19
21
  expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
20
22
  expect(xmpp).to receive(:send).with(message)
21
23
 
22
- UniformNotifier.xmpp = {:account => 'from@gmail.com', :password => '123456', :receiver => 'to@gmail.com', :show_online_status => false}
23
- UniformNotifier::Xmpp.out_of_channel_notify(:title => 'notify xmpp')
24
+ UniformNotifier.xmpp = { account: 'from@gmail.com', password: '123456', receiver: 'to@gmail.com', show_online_status: false }
25
+ UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
24
26
  end
25
27
 
26
- it "should notify xmpp with online status" do
27
- jid = double("jid")
28
- xmpp = double("xmpp")
28
+ it 'should notify xmpp with online status' do
29
+ jid = double('jid')
30
+ xmpp = double('xmpp')
29
31
  expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
30
32
  expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
31
33
  expect(xmpp).to receive(:connect)
32
34
  expect(xmpp).to receive(:auth).with('123456')
33
35
 
34
- presence = double("presence")
36
+ presence = double('presence')
35
37
  now = Time.now
36
38
  allow(Time).to receive(:now).and_return(now)
37
39
  expect(Jabber::Presence).to receive(:new).and_return(presence)
38
40
  expect(presence).to receive(:set_status).with("Uniform Notifier started on #{now}").and_return(presence)
39
41
  expect(xmpp).to receive(:send).with(presence)
40
42
 
41
- message = double("message")
43
+ message = double('message')
42
44
  expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
43
45
  expect(message).to receive(:set_type).with(:normal).and_return(message)
44
46
  expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
45
47
  expect(xmpp).to receive(:send).with(message)
46
48
 
47
- UniformNotifier.xmpp = {:account => 'from@gmail.com', :password => '123456', :receiver => 'to@gmail.com', :show_online_status => true}
48
- UniformNotifier::Xmpp.out_of_channel_notify(:title => 'notify xmpp')
49
+ UniformNotifier.xmpp = { account: 'from@gmail.com', password: '123456', receiver: 'to@gmail.com', show_online_status: true }
50
+ UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
49
51
  end
50
52
  end