uniform_notifier 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/uniform_notifier/version.rb +1 -1
- metadata +6 -44
- data/.github/workflows/ci.yml +0 -27
- data/.gitignore +0 -6
- data/Gemfile +0 -9
- data/Rakefile +0 -27
- data/spec/spec_helper.rb +0 -8
- data/spec/uniform_notifier/airbrake_spec.rb +0 -27
- data/spec/uniform_notifier/appsignal_spec.rb +0 -90
- data/spec/uniform_notifier/base_spec.rb +0 -20
- data/spec/uniform_notifier/bugsnag_spec.rb +0 -76
- data/spec/uniform_notifier/customized_logger_spec.rb +0 -24
- data/spec/uniform_notifier/honeybadger_spec.rb +0 -27
- data/spec/uniform_notifier/javascript_alert_spec.rb +0 -36
- data/spec/uniform_notifier/javascript_console_spec.rb +0 -63
- data/spec/uniform_notifier/opentelemetry_spec.rb +0 -33
- data/spec/uniform_notifier/rails_logger_spec.rb +0 -22
- data/spec/uniform_notifier/raise_spec.rb +0 -33
- data/spec/uniform_notifier/rollbar_spec.rb +0 -27
- data/spec/uniform_notifier/sentry_spec.rb +0 -27
- data/spec/uniform_notifier/slack_spec.rb +0 -58
- data/spec/uniform_notifier/terminal_notifier_spec.rb +0 -27
- data/spec/uniform_notifier/xmpp_spec.rb +0 -62
- data/uniform_notifier.gemspec +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0b1bd2e74026fffc6dabe2ecf5b5709884283e3cb7cf1c48d59f0df21a19b042
|
|
4
|
+
data.tar.gz: '093fef4d90199788c807a044e238aadbb51410857ac17a91c653292a854e1ff9'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1563e705f564ee432a7a0e6ffc357409c66f064496beac12c2a25b375dce008bade16584f4fa924b3447f69a0f3460005c8141c3980279c553ac0726b6443dfb
|
|
7
|
+
data.tar.gz: d494338a31ef48bad2bee9bb60dde9c1bab2ff05c0fbc45301076fcd8a73a5240c530241f01c60dfdcc926baac3f13f25b09f2a19a916dd1b0662bcc3786079a
|
data/CHANGELOG.md
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: uniform_notifier
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.18.
|
|
4
|
+
version: 1.18.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Richard Huang
|
|
@@ -51,21 +51,18 @@ dependencies:
|
|
|
51
51
|
- - '='
|
|
52
52
|
- !ruby/object:Gem::Version
|
|
53
53
|
version: '0.5'
|
|
54
|
-
description:
|
|
55
|
-
javascript console
|
|
54
|
+
description: uniform_notifier gives you the ability to send notification through rails
|
|
55
|
+
logger, customized logger, javascript alert, javascript console, xmpp, airbrake,
|
|
56
|
+
honeybadger, AppSignal and more
|
|
56
57
|
email:
|
|
57
58
|
- flyerhzm@gmail.com
|
|
58
59
|
executables: []
|
|
59
60
|
extensions: []
|
|
60
61
|
extra_rdoc_files: []
|
|
61
62
|
files:
|
|
62
|
-
- ".github/workflows/ci.yml"
|
|
63
|
-
- ".gitignore"
|
|
64
63
|
- CHANGELOG.md
|
|
65
|
-
- Gemfile
|
|
66
64
|
- LICENSE
|
|
67
65
|
- README.md
|
|
68
|
-
- Rakefile
|
|
69
66
|
- lib/uniform_notifier.rb
|
|
70
67
|
- lib/uniform_notifier/airbrake.rb
|
|
71
68
|
- lib/uniform_notifier/appsignal.rb
|
|
@@ -85,24 +82,6 @@ files:
|
|
|
85
82
|
- lib/uniform_notifier/terminal_notifier.rb
|
|
86
83
|
- lib/uniform_notifier/version.rb
|
|
87
84
|
- lib/uniform_notifier/xmpp.rb
|
|
88
|
-
- spec/spec_helper.rb
|
|
89
|
-
- spec/uniform_notifier/airbrake_spec.rb
|
|
90
|
-
- spec/uniform_notifier/appsignal_spec.rb
|
|
91
|
-
- spec/uniform_notifier/base_spec.rb
|
|
92
|
-
- spec/uniform_notifier/bugsnag_spec.rb
|
|
93
|
-
- spec/uniform_notifier/customized_logger_spec.rb
|
|
94
|
-
- spec/uniform_notifier/honeybadger_spec.rb
|
|
95
|
-
- spec/uniform_notifier/javascript_alert_spec.rb
|
|
96
|
-
- spec/uniform_notifier/javascript_console_spec.rb
|
|
97
|
-
- spec/uniform_notifier/opentelemetry_spec.rb
|
|
98
|
-
- spec/uniform_notifier/rails_logger_spec.rb
|
|
99
|
-
- spec/uniform_notifier/raise_spec.rb
|
|
100
|
-
- spec/uniform_notifier/rollbar_spec.rb
|
|
101
|
-
- spec/uniform_notifier/sentry_spec.rb
|
|
102
|
-
- spec/uniform_notifier/slack_spec.rb
|
|
103
|
-
- spec/uniform_notifier/terminal_notifier_spec.rb
|
|
104
|
-
- spec/uniform_notifier/xmpp_spec.rb
|
|
105
|
-
- uniform_notifier.gemspec
|
|
106
85
|
homepage: http://rubygems.org/gems/uniform_notifier
|
|
107
86
|
licenses:
|
|
108
87
|
- MIT
|
|
@@ -124,25 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
124
103
|
- !ruby/object:Gem::Version
|
|
125
104
|
version: '0'
|
|
126
105
|
requirements: []
|
|
127
|
-
rubygems_version:
|
|
106
|
+
rubygems_version: 4.0.6
|
|
128
107
|
specification_version: 4
|
|
129
108
|
summary: uniform notifier for rails logger, customized logger, javascript alert, javascript
|
|
130
109
|
console and xmpp
|
|
131
|
-
test_files:
|
|
132
|
-
- spec/spec_helper.rb
|
|
133
|
-
- spec/uniform_notifier/airbrake_spec.rb
|
|
134
|
-
- spec/uniform_notifier/appsignal_spec.rb
|
|
135
|
-
- spec/uniform_notifier/base_spec.rb
|
|
136
|
-
- spec/uniform_notifier/bugsnag_spec.rb
|
|
137
|
-
- spec/uniform_notifier/customized_logger_spec.rb
|
|
138
|
-
- spec/uniform_notifier/honeybadger_spec.rb
|
|
139
|
-
- spec/uniform_notifier/javascript_alert_spec.rb
|
|
140
|
-
- spec/uniform_notifier/javascript_console_spec.rb
|
|
141
|
-
- spec/uniform_notifier/opentelemetry_spec.rb
|
|
142
|
-
- spec/uniform_notifier/rails_logger_spec.rb
|
|
143
|
-
- spec/uniform_notifier/raise_spec.rb
|
|
144
|
-
- spec/uniform_notifier/rollbar_spec.rb
|
|
145
|
-
- spec/uniform_notifier/sentry_spec.rb
|
|
146
|
-
- spec/uniform_notifier/slack_spec.rb
|
|
147
|
-
- spec/uniform_notifier/terminal_notifier_spec.rb
|
|
148
|
-
- spec/uniform_notifier/xmpp_spec.rb
|
|
110
|
+
test_files: []
|
data/.github/workflows/ci.yml
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
- push
|
|
5
|
-
- pull_request
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
strategy:
|
|
11
|
-
fail-fast: false
|
|
12
|
-
matrix:
|
|
13
|
-
ruby:
|
|
14
|
-
- 3.0
|
|
15
|
-
- 3.1
|
|
16
|
-
- 3.2
|
|
17
|
-
- 3.3
|
|
18
|
-
steps:
|
|
19
|
-
- name: Checkout code
|
|
20
|
-
uses: actions/checkout@v3
|
|
21
|
-
- name: Set up Ruby
|
|
22
|
-
uses: ruby/setup-ruby@v1
|
|
23
|
-
with:
|
|
24
|
-
ruby-version: ${{ matrix.ruby }}
|
|
25
|
-
bundler-cache: true
|
|
26
|
-
- name: Run tests
|
|
27
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'bundler'
|
|
4
|
-
Bundler::GemHelper.install_tasks
|
|
5
|
-
|
|
6
|
-
require 'rake'
|
|
7
|
-
require 'rdoc/task'
|
|
8
|
-
require 'rspec'
|
|
9
|
-
require 'rspec/core/rake_task'
|
|
10
|
-
|
|
11
|
-
RSpec::Core::RakeTask.new(:spec) do |spec|
|
|
12
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
RSpec::Core::RakeTask.new('spec:progress') do |spec|
|
|
16
|
-
spec.rspec_opts = %w[--format progress]
|
|
17
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
Rake::RDocTask.new do |rdoc|
|
|
21
|
-
rdoc.rdoc_dir = 'rdoc'
|
|
22
|
-
rdoc.title = "uniform_notifier #{UniformNotifier::VERSION}"
|
|
23
|
-
rdoc.rdoc_files.include('README*')
|
|
24
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
task default: :spec
|
data/spec/spec_helper.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Airbrake
|
|
6
|
-
# mock Airbrake
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::AirbrakeNotifier do
|
|
10
|
-
it 'should not notify airbrake' do
|
|
11
|
-
expect(UniformNotifier::AirbrakeNotifier.out_of_channel_notify(title: 'notify airbrake')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify airbrake' do
|
|
15
|
-
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), {})
|
|
16
|
-
|
|
17
|
-
UniformNotifier.airbrake = true
|
|
18
|
-
UniformNotifier::AirbrakeNotifier.out_of_channel_notify(title: 'notify airbrake')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should notify airbrake' do
|
|
22
|
-
expect(Airbrake).to receive(:notify).with(UniformNotifier::Exception.new('notify airbrake'), { foo: :bar })
|
|
23
|
-
|
|
24
|
-
UniformNotifier.airbrake = { foo: :bar }
|
|
25
|
-
UniformNotifier::AirbrakeNotifier.out_of_channel_notify('notify airbrake')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Appsignal
|
|
6
|
-
# mock AppSignal
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::AppsignalNotifier do
|
|
10
|
-
it 'should not notify appsignal' do
|
|
11
|
-
expect(UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify appsignal with keyword title' do
|
|
15
|
-
expect(Appsignal).to receive(:send_error).with(UniformNotifier::Exception.new("notify appsignal\n"))
|
|
16
|
-
|
|
17
|
-
UniformNotifier.appsignal = true
|
|
18
|
-
expect(UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal'))
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should notify appsignal with first argument title' do
|
|
22
|
-
expect(Appsignal).to receive(:send_error).with(
|
|
23
|
-
UniformNotifier::Exception.new("notify appsignal\n")
|
|
24
|
-
)
|
|
25
|
-
|
|
26
|
-
UniformNotifier.appsignal = true
|
|
27
|
-
UniformNotifier::AppsignalNotifier.out_of_channel_notify('notify appsignal')
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
it 'should notify appsignal with tags' do
|
|
31
|
-
transaction = double('Appsignal::Transaction', set_namespace: nil)
|
|
32
|
-
expect(transaction).to receive(:set_tags).with({ foo: :bar })
|
|
33
|
-
expect(Appsignal).to receive(:send_error).with(
|
|
34
|
-
UniformNotifier::Exception.new("notify appsignal\n")
|
|
35
|
-
).and_yield(transaction)
|
|
36
|
-
|
|
37
|
-
UniformNotifier.appsignal = true
|
|
38
|
-
UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal', tags: { foo: :bar })
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it 'should notify appsignal with default namespace' do
|
|
42
|
-
transaction = double('Appsignal::Transaction', set_tags: nil)
|
|
43
|
-
expect(transaction).to receive(:set_namespace).with('web')
|
|
44
|
-
expect(Appsignal).to receive(:send_error).with(
|
|
45
|
-
UniformNotifier::Exception.new("notify appsignal\n")
|
|
46
|
-
).and_yield(transaction)
|
|
47
|
-
|
|
48
|
-
UniformNotifier.appsignal = { namespace: 'web' }
|
|
49
|
-
UniformNotifier::AppsignalNotifier.out_of_channel_notify('notify appsignal')
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'should notify appsignal with overridden namespace' do
|
|
53
|
-
transaction = double('Appsignal::Transaction')
|
|
54
|
-
expect(transaction).to receive(:set_tags).with({ foo: :bar })
|
|
55
|
-
expect(transaction).to receive(:set_namespace).with('background')
|
|
56
|
-
expect(Appsignal).to receive(:send_error).with(
|
|
57
|
-
UniformNotifier::Exception.new("notify appsignal\nbody")
|
|
58
|
-
).and_yield(transaction)
|
|
59
|
-
|
|
60
|
-
UniformNotifier.appsignal = { namespace: 'web' }
|
|
61
|
-
UniformNotifier::AppsignalNotifier.out_of_channel_notify(
|
|
62
|
-
title: 'notify appsignal',
|
|
63
|
-
tags: {
|
|
64
|
-
foo: :bar
|
|
65
|
-
},
|
|
66
|
-
namespace: 'background',
|
|
67
|
-
body: 'body',
|
|
68
|
-
)
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
it 'should notify appsignal with merged tags' do
|
|
72
|
-
transaction = double('Appsignal::Transaction')
|
|
73
|
-
expect(transaction).to receive(:set_tags).with({ user: 'Bob', hostname: 'frontend2', site: 'first' })
|
|
74
|
-
expect(transaction).to receive(:set_namespace).with('background')
|
|
75
|
-
expect(Appsignal).to receive(:send_error).with(
|
|
76
|
-
UniformNotifier::Exception.new("notify appsignal\nbody")
|
|
77
|
-
).and_yield(transaction)
|
|
78
|
-
|
|
79
|
-
UniformNotifier.appsignal = { namespace: 'web', tags: { hostname: 'frontend1', user: 'Bob' } }
|
|
80
|
-
UniformNotifier::AppsignalNotifier.out_of_channel_notify(
|
|
81
|
-
title: 'notify appsignal',
|
|
82
|
-
tags: {
|
|
83
|
-
hostname: 'frontend2',
|
|
84
|
-
site: 'first'
|
|
85
|
-
},
|
|
86
|
-
body: 'body',
|
|
87
|
-
namespace: 'background'
|
|
88
|
-
)
|
|
89
|
-
end
|
|
90
|
-
end
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::Base do
|
|
6
|
-
context '#inline_channel_notify' do
|
|
7
|
-
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
|
|
8
|
-
it 'should keep the compatibility' do
|
|
9
|
-
expect(UniformNotifier::Base).to receive(:_inline_notify).once.with({ title: 'something' })
|
|
10
|
-
UniformNotifier::Base.inline_notify('something')
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
context '#out_of_channel_notify' do
|
|
14
|
-
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
|
|
15
|
-
it 'should keep the compatibility' do
|
|
16
|
-
expect(UniformNotifier::Base).to receive(:_out_of_channel_notify).once.with({ title: 'something' })
|
|
17
|
-
UniformNotifier::Base.out_of_channel_notify('something')
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
end
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Bugsnag
|
|
6
|
-
# mock Bugsnag
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::BugsnagNotifier do
|
|
10
|
-
let(:notification_data) { {} }
|
|
11
|
-
let(:report) { double('Bugsnag::Report') }
|
|
12
|
-
before do
|
|
13
|
-
allow(report).to receive(:severity=)
|
|
14
|
-
allow(report).to receive(:add_tab)
|
|
15
|
-
allow(report).to receive(:grouping_hash=)
|
|
16
|
-
end
|
|
17
|
-
it 'should not notify bugsnag' do
|
|
18
|
-
expect(Bugsnag).not_to receive(:notify)
|
|
19
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
|
20
|
-
end
|
|
21
|
-
context 'with string notification' do
|
|
22
|
-
let(:notification_data) { 'notify bugsnag' }
|
|
23
|
-
|
|
24
|
-
it 'should notify bugsnag' do
|
|
25
|
-
expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
|
|
26
|
-
expect(report).to receive(:severity=).with('warning')
|
|
27
|
-
expect(report).to receive(:add_tab).with(:bullet, { title: notification_data })
|
|
28
|
-
expect(report).to receive(:grouping_hash=).with(notification_data)
|
|
29
|
-
|
|
30
|
-
UniformNotifier.bugsnag = true
|
|
31
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
it 'should notify bugsnag with additional report configuration' do
|
|
35
|
-
expect(Bugsnag).to receive(:notify).with(UniformNotifier::Exception.new(notification_data)).and_yield(report)
|
|
36
|
-
expect(report).to receive(:meta_data=).with({ foo: :bar })
|
|
37
|
-
|
|
38
|
-
UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
|
|
39
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
context 'with hash notification' do
|
|
43
|
-
let(:notification_data) { { user: 'user', title: 'notify bugsnag', url: 'URL', body: 'something' } }
|
|
44
|
-
|
|
45
|
-
it 'should notify bugsnag' do
|
|
46
|
-
expect(Bugsnag).to receive(:notify).with(
|
|
47
|
-
UniformNotifier::Exception.new(notification_data[:title])
|
|
48
|
-
).and_yield(report)
|
|
49
|
-
expect(report).to receive(:severity=).with('warning')
|
|
50
|
-
expect(report).to receive(:add_tab).with(:bullet, notification_data)
|
|
51
|
-
expect(report).to receive(:grouping_hash=).with(notification_data[:body])
|
|
52
|
-
|
|
53
|
-
UniformNotifier.bugsnag = true
|
|
54
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
it 'should notify bugsnag with option' do
|
|
58
|
-
expect(Bugsnag).to receive(:notify).with(
|
|
59
|
-
UniformNotifier::Exception.new(notification_data[:title])
|
|
60
|
-
).and_yield(report)
|
|
61
|
-
expect(report).to receive(:meta_data=).with({ foo: :bar })
|
|
62
|
-
|
|
63
|
-
UniformNotifier.bugsnag = ->(report) { report.meta_data = { foo: :bar } }
|
|
64
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(notification_data)
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
it 'should notify bugsnag with correct backtrace' do
|
|
69
|
-
expect(Bugsnag).to receive(:notify) do |error|
|
|
70
|
-
expect(error).to be_a UniformNotifier::Exception
|
|
71
|
-
expect(error.backtrace).to eq ['bugsnag spec test']
|
|
72
|
-
end
|
|
73
|
-
UniformNotifier.bugsnag = true
|
|
74
|
-
UniformNotifier::BugsnagNotifier.out_of_channel_notify(backtrace: ['bugsnag spec test'])
|
|
75
|
-
end
|
|
76
|
-
end
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::CustomizedLogger do
|
|
6
|
-
it 'should not notify to customized logger' do
|
|
7
|
-
expect(UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should notify to customized logger' do
|
|
11
|
-
logger = File.open('test.log', 'a+')
|
|
12
|
-
logger.sync = true
|
|
13
|
-
|
|
14
|
-
now = Time.now
|
|
15
|
-
allow(Time).to receive(:now).and_return(now)
|
|
16
|
-
UniformNotifier.customized_logger = logger
|
|
17
|
-
UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')
|
|
18
|
-
|
|
19
|
-
logger.seek(0)
|
|
20
|
-
expect(logger.read).to eq "#{now.strftime('%Y-%m-%d %H:%M:%S')}[WARN] notify rails logger"
|
|
21
|
-
|
|
22
|
-
File.delete('test.log')
|
|
23
|
-
end
|
|
24
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Honeybadger
|
|
6
|
-
# mock Honeybadger
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::HoneybadgerNotifier do
|
|
10
|
-
it 'should not notify honeybadger' do
|
|
11
|
-
expect(UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify honeybadger' do
|
|
15
|
-
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'))
|
|
16
|
-
|
|
17
|
-
UniformNotifier.honeybadger = true
|
|
18
|
-
UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should notify honeybadger' do
|
|
22
|
-
expect(Honeybadger).to receive(:notify).with(UniformNotifier::Exception.new('notify honeybadger'), foo: :bar)
|
|
23
|
-
|
|
24
|
-
UniformNotifier.honeybadger = { foo: :bar }
|
|
25
|
-
UniformNotifier::HoneybadgerNotifier.out_of_channel_notify('notify honeybadger')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::JavascriptAlert do
|
|
6
|
-
it 'should not notify message' do
|
|
7
|
-
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to be_nil
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should notify message' do
|
|
11
|
-
UniformNotifier.alert = true
|
|
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
|
|
35
|
-
end
|
|
36
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::JavascriptConsole do
|
|
6
|
-
it 'should not notify message' do
|
|
7
|
-
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to be_nil
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should notify message' do
|
|
11
|
-
UniformNotifier.console = true
|
|
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>
|
|
61
|
-
CODE
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class OpenTelemetry
|
|
6
|
-
class Trace
|
|
7
|
-
# mock OpenTelemetry
|
|
8
|
-
end
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
RSpec.describe UniformNotifier::OpenTelemetryNotifier do
|
|
12
|
-
it 'should not notify OpenTelemetry' do
|
|
13
|
-
expect(UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')).to be_nil
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
it 'should notify OpenTelemetry' do
|
|
17
|
-
span = double('span')
|
|
18
|
-
expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
|
|
19
|
-
expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
|
|
20
|
-
|
|
21
|
-
UniformNotifier.opentelemetry = true
|
|
22
|
-
UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'should notify OpenTelemetry' do
|
|
26
|
-
span = double('span')
|
|
27
|
-
expect(span).to receive(:record_exception).with(UniformNotifier::Exception.new('notify otel'))
|
|
28
|
-
expect(OpenTelemetry::Trace).to receive(:current_span).and_return(span)
|
|
29
|
-
|
|
30
|
-
UniformNotifier.opentelemetry = { foo: :bar }
|
|
31
|
-
UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify('notify otel')
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Rails
|
|
6
|
-
# mock Rails
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::RailsLogger do
|
|
10
|
-
it 'should not notify rails logger' do
|
|
11
|
-
expect(UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify rails logger' do
|
|
15
|
-
logger = double('logger')
|
|
16
|
-
expect(Rails).to receive(:logger).and_return(logger)
|
|
17
|
-
expect(logger).to receive(:warn).with('notify rails logger')
|
|
18
|
-
|
|
19
|
-
UniformNotifier.rails_logger = true
|
|
20
|
-
UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')
|
|
21
|
-
end
|
|
22
|
-
end
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::Raise do
|
|
6
|
-
it 'should not notify message' do
|
|
7
|
-
expect(UniformNotifier::Raise.out_of_channel_notify(title: 'notification')).to be_nil
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should raise error of the default class' do
|
|
11
|
-
UniformNotifier.raise = true
|
|
12
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
|
13
|
-
.to raise_error(
|
|
14
|
-
UniformNotifier::Exception,
|
|
15
|
-
'notification'
|
|
16
|
-
)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
it 'allows the user to override the default exception class' do
|
|
20
|
-
klass = Class.new(RuntimeError)
|
|
21
|
-
UniformNotifier.raise = klass
|
|
22
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
|
23
|
-
.to raise_error(klass, 'notification')
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
it 'can be turned from on to off again' do
|
|
27
|
-
UniformNotifier.raise = true
|
|
28
|
-
UniformNotifier.raise = false
|
|
29
|
-
|
|
30
|
-
expect { UniformNotifier::Raise.out_of_channel_notify(title: 'notification') }
|
|
31
|
-
.not_to raise_error
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Rollbar
|
|
6
|
-
# mock Rollbar
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::RollbarNotifier do
|
|
10
|
-
it 'should not notify rollbar' do
|
|
11
|
-
expect(UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify rollbar' do
|
|
15
|
-
expect(Rollbar).to receive(:log).with('info', UniformNotifier::Exception.new('notify rollbar'))
|
|
16
|
-
|
|
17
|
-
UniformNotifier.rollbar = true
|
|
18
|
-
UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should notify rollbar' do
|
|
22
|
-
expect(Rollbar).to receive(:log).with('warning', UniformNotifier::Exception.new('notify rollbar'))
|
|
23
|
-
|
|
24
|
-
UniformNotifier.rollbar = { level: 'warning' }
|
|
25
|
-
UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
class Sentry
|
|
6
|
-
# mock Sentry
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
RSpec.describe UniformNotifier::SentryNotifier do
|
|
10
|
-
it 'should not notify sentry' do
|
|
11
|
-
expect(UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')).to be_nil
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
it 'should notify sentry' do
|
|
15
|
-
expect(Sentry).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'))
|
|
16
|
-
|
|
17
|
-
UniformNotifier.sentry = true
|
|
18
|
-
UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
it 'should notify sentry' do
|
|
22
|
-
expect(Sentry).to receive(:capture_exception).with(UniformNotifier::Exception.new('notify sentry'), foo: :bar)
|
|
23
|
-
|
|
24
|
-
UniformNotifier.sentry = { foo: :bar }
|
|
25
|
-
UniformNotifier::SentryNotifier.out_of_channel_notify('notify sentry')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::Slack do
|
|
6
|
-
context 'not enabled' do
|
|
7
|
-
it 'should not notify slack' do
|
|
8
|
-
expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
|
|
9
|
-
expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
|
|
10
|
-
end
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
context 'configuration' do
|
|
14
|
-
context 'no webhook_url is given' do
|
|
15
|
-
it 'should raise an error' do
|
|
16
|
-
expect { UniformNotifier.slack = {} }
|
|
17
|
-
.to raise_error(UniformNotifier::NotificationError)
|
|
18
|
-
end
|
|
19
|
-
|
|
20
|
-
it 'should not notify slack' do
|
|
21
|
-
begin
|
|
22
|
-
UniformNotifier.slack = {}
|
|
23
|
-
rescue UniformNotifier::NotificationError
|
|
24
|
-
ensure
|
|
25
|
-
expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
|
|
26
|
-
expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it 'should remove invalid options' do
|
|
32
|
-
expect(Slack::Notifier).to receive(:new).with('http://some.slack.url', {}).and_return(true)
|
|
33
|
-
UniformNotifier.slack = { webhook_url: 'http://some.slack.url', pizza: 'pepperoni' }
|
|
34
|
-
expect(UniformNotifier::Slack.active?).to eq true
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
it 'should allow username and channel config options' do
|
|
38
|
-
expect(Slack::Notifier).to receive(:new)
|
|
39
|
-
.with('http://some.slack.url', { username: 'The Dude', channel: '#carpets' })
|
|
40
|
-
.and_return(true)
|
|
41
|
-
UniformNotifier.slack = { webhook_url: 'http://some.slack.url', username: 'The Dude', channel: '#carpets' }
|
|
42
|
-
expect(UniformNotifier::Slack.active?).to eq true
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
context 'properly configured' do
|
|
47
|
-
before(:example) do
|
|
48
|
-
@message = 'notify slack'
|
|
49
|
-
allow_any_instance_of(Slack::Notifier).to receive(:ping).and_return(@message)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
it 'should notify slack' do
|
|
53
|
-
UniformNotifier.slack = { webhook_url: 'http://some.slack.url' }
|
|
54
|
-
expect_any_instance_of(Slack::Notifier).to receive(:ping)
|
|
55
|
-
expect(UniformNotifier::Slack.out_of_channel_notify(title: @message)).to eq @message
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
end
|
|
@@ -1,27 +0,0 @@
|
|
|
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 {
|
|
13
|
-
UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
|
|
14
|
-
}.to raise_error(UniformNotifier::NotificationError, /terminal-notifier gem/)
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
it 'should notify terminal-notifier when enabled' do
|
|
18
|
-
module TerminalNotifier
|
|
19
|
-
# mock TerminalNotifier
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
expect(TerminalNotifier).to receive(:notify).with('body', title: 'notify terminal')
|
|
23
|
-
|
|
24
|
-
UniformNotifier.terminal_notifier = true
|
|
25
|
-
UniformNotifier::TerminalNotifier.out_of_channel_notify(body: 'body', title: 'notify terminal')
|
|
26
|
-
end
|
|
27
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe UniformNotifier::Xmpp do
|
|
6
|
-
it 'should not notify xmpp' do
|
|
7
|
-
expect(UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')).to be_nil
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
it 'should notify xmpp without online status' do
|
|
11
|
-
jid = double('jid')
|
|
12
|
-
xmpp = double('xmpp')
|
|
13
|
-
expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
|
|
14
|
-
expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
|
|
15
|
-
expect(xmpp).to receive(:connect)
|
|
16
|
-
expect(xmpp).to receive(:auth).with('123456')
|
|
17
|
-
|
|
18
|
-
message = double('message')
|
|
19
|
-
expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
|
|
20
|
-
expect(message).to receive(:set_type).with(:normal).and_return(message)
|
|
21
|
-
expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
|
|
22
|
-
expect(xmpp).to receive(:send).with(message)
|
|
23
|
-
|
|
24
|
-
UniformNotifier.xmpp = {
|
|
25
|
-
account: 'from@gmail.com',
|
|
26
|
-
password: '123456',
|
|
27
|
-
receiver: 'to@gmail.com',
|
|
28
|
-
show_online_status: false
|
|
29
|
-
}
|
|
30
|
-
UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
it 'should notify xmpp with online status' do
|
|
34
|
-
jid = double('jid')
|
|
35
|
-
xmpp = double('xmpp')
|
|
36
|
-
expect(Jabber::JID).to receive(:new).with('from@gmail.com').and_return(jid)
|
|
37
|
-
expect(Jabber::Client).to receive(:new).with(jid).and_return(xmpp)
|
|
38
|
-
expect(xmpp).to receive(:connect)
|
|
39
|
-
expect(xmpp).to receive(:auth).with('123456')
|
|
40
|
-
|
|
41
|
-
presence = double('presence')
|
|
42
|
-
now = Time.now
|
|
43
|
-
allow(Time).to receive(:now).and_return(now)
|
|
44
|
-
expect(Jabber::Presence).to receive(:new).and_return(presence)
|
|
45
|
-
expect(presence).to receive(:set_status).with("Uniform Notifier started on #{now}").and_return(presence)
|
|
46
|
-
expect(xmpp).to receive(:send).with(presence)
|
|
47
|
-
|
|
48
|
-
message = double('message')
|
|
49
|
-
expect(Jabber::Message).to receive(:new).with('to@gmail.com', 'notify xmpp').and_return(message)
|
|
50
|
-
expect(message).to receive(:set_type).with(:normal).and_return(message)
|
|
51
|
-
expect(message).to receive(:set_subject).with('Uniform Notifier').and_return(message)
|
|
52
|
-
expect(xmpp).to receive(:send).with(message)
|
|
53
|
-
|
|
54
|
-
UniformNotifier.xmpp = {
|
|
55
|
-
account: 'from@gmail.com',
|
|
56
|
-
password: '123456',
|
|
57
|
-
receiver: 'to@gmail.com',
|
|
58
|
-
show_online_status: true
|
|
59
|
-
}
|
|
60
|
-
UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')
|
|
61
|
-
end
|
|
62
|
-
end
|
data/uniform_notifier.gemspec
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
4
|
-
require 'uniform_notifier/version'
|
|
5
|
-
|
|
6
|
-
Gem::Specification.new do |s|
|
|
7
|
-
s.name = 'uniform_notifier'
|
|
8
|
-
s.version = UniformNotifier::VERSION
|
|
9
|
-
s.platform = Gem::Platform::RUBY
|
|
10
|
-
s.authors = ['Richard Huang']
|
|
11
|
-
s.email = ['flyerhzm@gmail.com']
|
|
12
|
-
s.homepage = 'http://rubygems.org/gems/uniform_notifier'
|
|
13
|
-
s.summary = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
|
|
14
|
-
s.description = 'uniform notifier for rails logger, customized logger, javascript alert, javascript console and xmpp'
|
|
15
|
-
s.license = 'MIT'
|
|
16
|
-
|
|
17
|
-
s.required_ruby_version = '>= 2.3'
|
|
18
|
-
|
|
19
|
-
s.add_development_dependency 'rspec', ['> 0']
|
|
20
|
-
s.add_development_dependency 'slack-notifier', ['>= 1.0']
|
|
21
|
-
s.add_development_dependency 'xmpp4r', ['= 0.5']
|
|
22
|
-
|
|
23
|
-
s.files = `git ls-files`.split("\n")
|
|
24
|
-
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
|
25
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
26
|
-
s.require_paths = ['lib']
|
|
27
|
-
|
|
28
|
-
if s.respond_to?(:metadata)
|
|
29
|
-
s.metadata['changelog_uri'] = 'https://github.com/flyerhzm/uniform_notifier/blob/master/CHANGELOG.md'
|
|
30
|
-
s.metadata['source_code_uri'] = 'https://github.com/flyerhzm/uniform_notifier'
|
|
31
|
-
s.metadata['bug_tracker_uri'] = 'https://github.com/flyerhzm/uniform_notifier/issues'
|
|
32
|
-
end
|
|
33
|
-
end
|