slack_message 2.3.0 → 2.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b476b987543e7a38fd316de55186ddee859dfc1bd71817b14ddd13b2cb79f59
4
- data.tar.gz: 80932a2d8e1bcac51239ea7724cd42f419dadfb7061fd939f359c2f4a5743777
3
+ metadata.gz: 25b5670dec5c6c5d2ba870180aa636f192cce3c9d899936337f553bc18108b7d
4
+ data.tar.gz: 47bd6ff799803ce186cdd01057dfa47a852422c715a2d1c550a6d41fc484ba18
5
5
  SHA512:
6
- metadata.gz: c6273ff440e4aa2fd9c4dba40c7e45e4c3840d02d7619dafb11d516f9a3541172499e0e81f1966103a89332bb3911fb96818984fadc0195faa27c9b5e1692fcb
7
- data.tar.gz: fc1a7df622d0cfd0c10311a70478cba43b893d7cde189d4f55dd997196e544145f8ce855a4b82af920f4320314907a6fe91bb39fddf3ba5e9460d4b8a4cbb33a
6
+ metadata.gz: 022ca4f2ffb28a3976be37d7104fd59e3ed296d406bf90176b4745c36880a159306112eb444ca1a1151720ad1cdb6a08e2b2779ad1ff2151e837fbee925c5808
7
+ data.tar.gz: a3f3d4c889e7c4036c2063f0ef038c54f515779526c6d4a9b0858e5e812bf2ba6667e08298b63988a074f82066c8d7eb9494b3d02d6c4785ff291cbfc7824f75
@@ -11,7 +11,7 @@ jobs:
11
11
  strategy:
12
12
  matrix:
13
13
  os: [ubuntu-latest, macos-latest]
14
- ruby-version: [3.0, 2.7, 2.6]
14
+ ruby-version: [3.0, 2.7, 2.6, 2.5]
15
15
  runs-on: ${{ matrix.os }}
16
16
 
17
17
  steps:
data/.gitignore CHANGED
@@ -1 +1,2 @@
1
+ Gemfile.lock
1
2
  slack_message*.gem
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.3.1] - 2021-11-30
4
+ - Adjust that minimum version by changing some syntax to older styles. Given
5
+ support for ruby 2.4 ended almost 2 years ago, going to go ahead and leave
6
+ it behind.
7
+ - Remove lockfile from repo
8
+
3
9
  ## [2.3.0] - 2021-11-30
4
10
  - Formally require minimum version of ruby. It wouldn't have worked anyway,
5
11
  but worth actually specifying.
@@ -111,12 +111,14 @@ class SlackMessage::Dsl
111
111
  # replace emails w/ real user IDs
112
112
  def enrich_text(text_body)
113
113
  text_body.scan(SlackMessage::EMAIL_TAG_PATTERN).each do |email_tag|
114
- raw_email = email_tag.gsub(/[><]/, '')
115
- user_id = SlackMessage::Api::user_id_for(raw_email, profile)
114
+ begin
115
+ raw_email = email_tag.gsub(/[><]/, '')
116
+ user_id = SlackMessage::Api::user_id_for(raw_email, profile)
116
117
 
117
- text_body.gsub!(email_tag, "<@#{user_id}>") if user_id
118
- rescue SlackMessage::ApiError => e
119
- # swallow errors for not-found users
118
+ text_body.gsub!(email_tag, "<@#{user_id}>") if user_id
119
+ rescue SlackMessage::ApiError => e
120
+ # swallow errors for not-found users
121
+ end
120
122
  end
121
123
 
122
124
  text_body
@@ -206,11 +206,11 @@ module SlackMessage::RSpec
206
206
  SlackMessage::RSpec.unregister_expectation_listener(self)
207
207
 
208
208
  @captured_calls
209
- .filter { |call| !@channel || call[:channel] == @channel }
210
- .filter { |call| !@profile || [call[:profile][:handle], call[:username]].include?(@profile) }
211
- .filter { |call| !@content || call.fetch(:blocks).to_s =~ @content }
212
- .filter { |call| !@icon || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) == @icon }
213
- .filter { |call| !@icon_matching || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) =~ @icon_matching }
209
+ .select { |call| !@channel || call[:channel] == @channel }
210
+ .select { |call| !@profile || [call[:profile][:handle], call[:username]].include?(@profile) }
211
+ .select { |call| !@content || call.fetch(:blocks).to_s =~ @content }
212
+ .select { |call| !@icon || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) == @icon }
213
+ .select { |call| !@icon_matching || call.fetch(:icon_emoji, call.fetch(:icon_url, '')) =~ @icon_matching }
214
214
  .any?
215
215
  end
216
216
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'slack_message'
3
- gem.version = "2.3.0"
3
+ gem.version = "2.3.1"
4
4
  gem.summary = "A nice DSL for composing rich messages in Slack"
5
5
  gem.authors = ["Joe Mastey"]
6
6
  gem.email = 'hello@joemastey.com'
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  "source_code_uri" => "http://github.com/jmmastey/slack_message",
19
19
  }
20
20
 
21
- gem.required_ruby_version = '>= 2.6.0'
21
+ gem.required_ruby_version = '>= 2.5.0'
22
22
 
23
23
  gem.add_development_dependency "rspec", "3.10.0"
24
24
  gem.add_development_dependency "pry", "0.14.1"
@@ -142,13 +142,19 @@ RSpec.describe SlackMessage do
142
142
  expect {
143
143
  SlackMessage.post_to('#general') { text("Not Tagged: hello@joemastey.com ") }
144
144
  }.to post_to_slack.with_content_matching(/hello@joemastey.com/)
145
+ end
145
146
 
146
-
147
- allow(SlackMessage::Api).to receive(:user_id_for).and_raise(SlackMessage::ApiError)
147
+ it "is graceful about those failures" do
148
+ allow(SlackMessage::Api).to receive(:user_id_for).with('nuffin@nuffin.nuffin', any_args).and_raise(SlackMessage::ApiError)
149
+ allow(SlackMessage::Api).to receive(:user_id_for).with('hello@joemastey.com', any_args).and_return('ABC123')
148
150
 
149
151
  expect {
150
152
  SlackMessage.post_to('#general') { text("Not User: <nuffin@nuffin.nuffin>") }
151
153
  }.to post_to_slack.with_content_matching(/\<nuffin@nuffin.nuffin\>/)
154
+
155
+ expect {
156
+ SlackMessage.post_to('#general') { text("Not User: <nuffin@nuffin.nuffin>, User: <hello@joemastey.com>") }
157
+ }.to post_to_slack.with_content_matching(/ABC123/)
152
158
  end
153
159
  end
154
160
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_message
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joe Mastey
@@ -64,7 +64,6 @@ files:
64
64
  - CHANGELOG.md
65
65
  - CODE_OF_CONDUCT.md
66
66
  - Gemfile
67
- - Gemfile.lock
68
67
  - MIT-LICENSE
69
68
  - README.md
70
69
  - lib/slack_message.rb
@@ -90,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
89
  requirements:
91
90
  - - ">="
92
91
  - !ruby/object:Gem::Version
93
- version: 2.6.0
92
+ version: 2.5.0
94
93
  required_rubygems_version: !ruby/object:Gem::Requirement
95
94
  requirements:
96
95
  - - ">="
data/Gemfile.lock DELETED
@@ -1,40 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- slack_message (2.3.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- coderay (1.1.3)
10
- diff-lcs (1.4.4)
11
- method_source (1.0.0)
12
- pry (0.14.1)
13
- coderay (~> 1.1)
14
- method_source (~> 1.0)
15
- rb-readline (0.5.5)
16
- rspec (3.10.0)
17
- rspec-core (~> 3.10.0)
18
- rspec-expectations (~> 3.10.0)
19
- rspec-mocks (~> 3.10.0)
20
- rspec-core (3.10.1)
21
- rspec-support (~> 3.10.0)
22
- rspec-expectations (3.10.1)
23
- diff-lcs (>= 1.2.0, < 2.0)
24
- rspec-support (~> 3.10.0)
25
- rspec-mocks (3.10.2)
26
- diff-lcs (>= 1.2.0, < 2.0)
27
- rspec-support (~> 3.10.0)
28
- rspec-support (3.10.2)
29
-
30
- PLATFORMS
31
- ruby
32
-
33
- DEPENDENCIES
34
- pry (= 0.14.1)
35
- rb-readline (= 0.5.5)
36
- rspec (= 3.10.0)
37
- slack_message!
38
-
39
- BUNDLED WITH
40
- 2.1.4